A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [RESOLVED] Calling External Swf And Loading On A Frame Label

  1. #1
    Member
    Join Date
    Sep 2009
    Posts
    66

    resolved [RESOLVED] Calling External Swf And Loading On A Frame Label

    I have a button on my main timeline that calls an external swf file into an empty container movie. How do I load external swf file and play on a particular frame label?
    I want to load a file called original.swf and start playing on a frame label called wheels.

    any ideas?
    Thanks!

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    You need to load the movie and then add an Eventlistener with a COMPLETE event. Within the listener function you then use

    event.currentTarget.content.gotoAndPlay("wheels");

    Check the language reference for the Loader class. There are examples.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Member
    Join Date
    Sep 2009
    Posts
    66
    Thank you for your answer,

    i made this:

    Code:
    stop();
    var my_loader:Loader = new Loader();
    addChild(my_loader);
    
    button.addEventListener(MouseEvent.CLICK, clickmouse);
    
    function clickmouse(evt:MouseEvent):void {
         my_loader.load(new URLRequest("a.swf"));
    }
    
    my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, startListener);
    
    function startListener (e:Event):void{
    trace("Loading complete");
    e.currentTarget.gotoAndPlay("B");
    }
    And the output windows show this:

    Loading complete
    ReferenceError: Error #1069: Property gotoAndPlay not found on flash.display.LoaderInfo and there is no default value.
    at test1_fla::MainTimeline/startListener()


    What am i doing wrong?

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    e.currentTarget.content.gotoAndPlay("B");
    - The right of the People to create Flash movies shall not be infringed. -

  5. #5
    Member
    Join Date
    Sep 2009
    Posts
    66
    Thanks for your help is not working yet, the output windows show this:

    Loading complete
    ArgumentError: Error #2109: Frame label B not found in scene Scene 1.
    at flash.display::MovieClip/gotoAndPlay()
    at test1_fla::MainTimeline/startListener()

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    It means you don't have a frame label "B" in your movie. Check your movie for that.
    - The right of the People to create Flash movies shall not be infringed. -

  7. #7
    Member
    Join Date
    Sep 2009
    Posts
    66
    thank you for response, by the way i found a solution, an this is it:

    Code:
    var ldr:Loader = new Loader();
    var urlReq:URLRequest = new URLRequest("external.swf");
    ldr.load(urlReq);
    
    function loadHandler (e:Event) {
    
    var myClip:MovieClip = e.target.content;
    addChild(myClip);
    
    ///////////////////////////////////////////////////////////////
    function clickSub(e:MouseEvent):void {
    myClip.nosotrosmc.gotoAndStop(e.target.name);
    //myClip.islasmc.gotoAndStop(e.target.name);
    
    }
    
    // set listeners subButtons
    button.addEventListener(MouseEvent.MOUSE_UP, clickSub);
    
    }
    
    // listener
    ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loadHandler);
    Hope this serves like reference......

    thank you for your help

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center