User Tag List

Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 23

Thread: 3rd party preloaders success!

  1. #1
    Clicker Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)iOS Export Module (Steam)

    Join Date
    Sep 2008
    Location
    Western Australia
    Posts
    256
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    3rd party preloaders success!

    I have managed to create a proof-of-concept AS3 template for implementing third party preloaders with MMF SWFs.

    Please note that there may be some issues depending on the resolution of your game and the advert, but it shouldn't be too difficult to sort out. If I get time, I will try to create something that does it all automatically. I have also noticed a delay of a couple of seconds after the preloader has been displayed, but again, I should be able to fix it.

    The key things that you need to do are:

    1) change the name of your game SWF to game.swf
    2) change the name of your preloader SWF to preloader.swf

    Alternatively, change the references to the SWFs in the template.

    Put your SWFs into the same folder as the template prior to compiling.

    In the code template, you may need to:

    1) specify the height/width of the preloader
    2) specify the amount of time your preloader needs to run completely

    The code is heavily commented and the bits you need to change are marked with 3 asterisks ***.

    With the current template, the preloader needs to be a SWF and this can be achieved in several ways, e.g...

    - Ask the sponsor to provide a SWF
    - Compile a preloader provided as FLA into a SWF
    - Screen-record the preloader running and convert it to a SWF using (e.g.) Format Factory.

    For those of you who cannot compile AS3 code (and even if you do not understand it), it can be done quite easily and completely free of charge using the open source FlashDevelop tool. If you have never used it before, it might take an hour to set up because you need to install Java and the Flex framework, but it is all free and not difficult. It's what I have used for this project from start to finish, so I can testify that everything specified in this message can be achieved free of charge (except buying MMF, of course)!

    Here's the code - just copy and paste it into FlashDevelop. Unfortunately, my code indents don't display, but it should be clear enough. I should point out, for those unfamiliar with ActionScript, that comments are preceded with \\ or /* so although there are 80 or so lines, there are only about 25 lines of code and you will only have to change 3 or 4 of those at most...
    package
    {

    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.TimerEvent;
    import flash.utils.Timer;

    /**
    * ...
    * @author Digitalic
    *
    * Proof-of-concept for adding a third-party preloader to a MMF-created SWF
    * There are a few things to sort out, but it works in principle
    *
    * The bits that you may need to change are commented and marked with 3 asterisks //***
    *
    */

    public class Main extends Sprite

    {
    //embed the preloader SWF and create a variable in which to hold it
    //*** Change 'preloader.swf' to match the SWF for your preloader ***
    [Embed(source = 'preloader.swf')]
    private var Preloader:Class;

    //embed the game SWF and create a variable in which to hold it
    //*** Change 'game.swf' to match the SWF for your game ***
    [Embed(source = 'game.swf')]
    private var Game:Class;

    //create the the preloader as a Sprite
    private var preloader:Sprite = new Preloader();

    //Create the timer
    //The first parameter is milliseconds and the second paramter is how many times you want it to run
    //*** In the line below, the 5000 is the number of milliseconds to wait until your game is displayed ***
    private var preloaderTimer:Timer = new Timer(5000, 1);

    //Main function
    public function Main():void
    {
    //waits for the stage to be initialised and calls the init routine when ready
    if (stage) init();
    else addEventListener(Event.ADDED_TO_STAGE, init);
    }

    //Initialisation function; this is the main section
    private function init(e:Event = null):void
    {
    //remove the stage event listener
    removeEventListener(Event.ADDED_TO_STAGE, init);

    //sets the correct width/height for the preloader
    //*** change the width of the preloader as required***
    preloader.width = 640;
    //*** change the height of the preloader as required***
    preloader.height = 480;

    //add the preloader to the stage
    addChild(preloader);

    //create an event listener for the timer which will allow the preloader to run
    //for the specified amount of time (set at 5000 milliseconds in this example).
    //When the timer reaches the specified time, the showGame function will be called
    preloaderTimer.addEventListener(TimerEvent.TIMER, showGame);

    //start the timer (which is set to 5 seconds in this example)
    preloaderTimer.start();

    }

    //this function is called when the timer reaches the specified time (5 secs in this example)
    private function showGame(evt:TimerEvent):void
    {
    //remove the preloader from the stage
    removeChild(preloader);

    //create a sprite for the game
    var game:Sprite = new Game();

    //add the game sprite to the stage
    addChild(game);
    }

    }

    }



  2. #2
    Clicker Fusion 2.5 Mac

    Join Date
    Dec 2008
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: 3rd party preloaders success!

    Awesome...

    Only for MMF2 DEV right?

  3. #3
    RayMarble
    Guest

    Re: 3rd party preloaders success!

    Quote Originally Posted by PandaExplosion
    Awesome...
    Only for MMF2 DEV right?
    Quote Originally Posted by Digitalic
    For those of you who cannot compile AS3 code (and even if you do not understand it), it can be done quite easily and completely free of charge using the open source FlashDevelop tool.
    Flashdevelop is a tool that allows you to write Flash programs for free (unlike TGF2/MMF2 and Flash itself it's all very manual though). Here's how to set it up.

  4. #4
    Clicker Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)iOS Export Module (Steam)

    Join Date
    Sep 2008
    Location
    Western Australia
    Posts
    256
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: 3rd party preloaders success!

    Only for MMF2 DEV right?
    No, it will work with any SWF, regardless of the software used to create it.

    Whilst RayMarble has stated that it is "very manual", once the (free) FlashDevelop IDE is installed and working, you just need to paste my code into it, change 3 or 4 variables and press F5 to produced your compiled SWF game with a preloader. It also creates a basic web page with the SWF embedded in it, so it is literally a couple of clicks to compile and test your game with a 3rd party preloader.

    If you have any SWF game and any SWF preloader, you can produce the finished product in a matter of 2 or 3 minutes or less using the provided template.

    Just a reminder that although the template I have provided works 100%, it is just a proof-of-concept and needs a bit of tidying up which I will be happy to do as and when I can find time.

  5. #5
    RayMarble
    Guest

    Re: 3rd party preloaders success!

    I meant developing applications in FD is "very manual" in general (compared to working in TGF2/MMF2 or Flash), wasn't referring to anything in particular.

  6. #6
    Clicker Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)iOS Export Module (Steam)

    Join Date
    Sep 2008
    Location
    Western Australia
    Posts
    256
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: 3rd party preloaders success!

    Quote Originally Posted by RayMarble
    I meant developing applications in FD is "very manual" in general (compared to working in TGF2/MMF2 or Flash), wasn't referring to anything in particular.
    Sorry, I didn't mean to be critical of your comment; I just wanted to make it clear that using the template I provided is not "very manual".

    You are absolutely right, of course; developing in FlashDevelop is indeed a very manual process!

  7. #7
    Clicker Fusion 2.5 Mac

    Join Date
    Dec 2008
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: 3rd party preloaders success!

    You're a lifesaver dude.

    People won't lost sponsoring anymore due to this : )

    Just made my mind on buyng the SWF exporter xD

  8. #8
    Clicker Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)iOS Export Module (Steam)

    Join Date
    Sep 2008
    Location
    Western Australia
    Posts
    256
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: 3rd party preloaders success!

    Just made my mind on buyng the SWF exporter xD
    Before you commit, you could have a go at using the template on any SWF files you can get you hands on.

    Have a go at installing FlashDevelop first and get it to compile. It would a shame to invest before you are confident that you can achieve the desired result.

    Remember the template I created is an early prototype!

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fanotherpg's Avatar
    Join Date
    Jul 2006
    Location
    High Wycombe, Buckinghamshire, UK
    Posts
    3,665
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: 3rd party preloaders success!

    I believe this one should be sticked.

  10. #10
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    Stephen's Avatar
    Join Date
    Aug 2008
    Location
    Montana
    Posts
    4,515
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: 3rd party preloaders success!

    Quote Originally Posted by Fanotherpg
    I believe this one should be sticked.
    It already was.
    _____________________________________________
    Nivram's Examples -Need extensions? Send me a PM.-


Page 1 of 3 1 2 3 LastLast

Similar Threads

  1. Any success?
    By DistantJ in forum XNA Export Module Version 2.0
    Replies: 7
    Last Post: 12th February 2013, 04:44 PM
  2. FGL, Preloaders, Preloader extension
    By Shawn in forum SWF/Flash Export Module Version 2.0
    Replies: 2
    Last Post: 4th July 2012, 02:22 AM
  3. Sponsor Preloaders
    By Stephen in forum SWF/Flash Export Module Version 2.0
    Replies: 51
    Last Post: 1st July 2012, 02:43 AM
  4. Preloaders
    By Olivier in forum SWF/Flash Export Module Version 2.0
    Replies: 27
    Last Post: 2nd July 2010, 11:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •