Control loaded swf on the main timeline

Hello

I'm working on loading external swf files for ios. I am able to load swf files and assembled visible or invisible in different settings. I have trouble controlling the swf files loaded on the main timeline. Specifically, I would like to have a button on the main timeline, that when you click on will move a swf loaded to frame 1.

Here is a code that loads a swf file:

var myLoader1:Loader;

var loaderContext1:LoaderContext = new LoaderContext (false null, ApplicationDomain.currentDomain),

if(myLoader1 == null)

{

myLoader1 = new Loader();

addChild (myLoader1);

}

myLoader1.load (new URLRequest("folder/file1.swf"), loaderContext1);

myLoader1.visible = true;

backbutton.addEventListener (MouseEvent.MOUSE_DOWN, backbutton1);

function backbutton1(myEvent:MouseEvent):void {? myLoader1.gotoAndStop (1) ;}}  (this line does not work)

(Once I load file1.swf, in the file1.swf I click a next button to move on to different periods.) My question is: hHow do I code the "backbutton" on the main timeline so that it causes the file1.swf to go to frame 1?)

Thank you for your help.

After loading is complete (and assuming that you load an as3 swf), you can use:

MovieClip (myLoader1.content) .gotoAndStop (1);

Tags: Adobe Animate

Similar Questions

  • Its inhibition in a loaded swf to the main swf

    I have a swf file that I'm loading and I need to be able to cut the sound of these soundChannels in the keyframes inside the other swf file.

    I have a mute button that I am activating / deactivating its visibility on and outside, one for a mute for the sound. I need to be able to access the audio clip in the external swf file. Any ideas?

    Thanks in advance.

    the best way to proceed is to use the correct path/name to your sound instance.  a popular sloppier way to use:

    SoundMixer.stopAll ();

  • referencing the main timeline from a loaded swf file

    I just poked around google as both of these forums, but the only answer I see that was a success, is kglad, and for some reason that its messages are not, I just see ":" and then the guy say thank you! Not uber useful.

    In any case, I'm just trying to understand how to reference an image tag on my main timeline to a swf loaded (through my imageLoader). Does anyone have a link or can tell me what I should look for in? dispatchers of the event?

    to reference the main timeline of the SWF loading from the main timeline of the swf file that is loaded, use:

    MovieClip (this.parent.parent)

  • CLICK in the main timeline > > will click where is designated in loaded swf?

    Seems doable, but difficult to grasp the concept...

    I have a slideshow loaded swf in this slide show, I assigned "next" and "prev" buttons to promote and save my slide show via the image labels ("avowed") for example... Here is an example:

    btn_next.addEventListener (MouseEvent.CLICK, nextClick);

    function nextClick (e:MouseEvent): void {}
    this.gotoAndPlay ("twoIn");
    }

    I want this function to execute when I click a State hit on the main timeline above him. So, how I would trigger the function above with a click on the State of success in the main timeline?

    To help, here is my code for the mouse over the function using the State of success that refers to the external buttons:

    pNextH.addEventListener (MouseEvent.MOUSE_OVER, nextOver);

    function nextOver (e:MouseEvent): void {}
    var mc:MovieClip = MovieClip (imageLoader.content);
    MC.btn_next.gotoAndPlay ("nextOver");
    }

    Code of THS I gave calls the nextClick() function that is defined in the main timeline of your loaded swf file, assuming nextClick() is in the main timeline and yourloader is the reference of your charger.

  • Toolbox for CreateJS: how to control the main timeline from outside the canvas.

    Hey everybody,

    I'm currently doing something simple, but my animation film breaks whenever I try to change my code. I created a basic animation in Flash where an object moves from the left side of the canvas, to the right and then loops of the last frame of the first image. Nothing else. The animation is simply placed on the main timeline. I exported the animation with the Toolbox for CreateJS through the extension of the Flash and animation series as it should. I'm trying to start and stop (reboot of the first image) the animation with the mouse on and off mouse events. I want that the events to fire when wriggling over/stop a div outside the animation canvas tag. Is this possible with CreateJS? I'm trying to find a way to control the main timeline without being inside the canvas tag.

    HTML example:

    http://www.thephotoncore.com/testing/example_test.html

    Example Code:

    < id article 'container' = >

    < canvas id = "canvas" width = "550" height = "400" style = "background-color: #cccccc" > < / canvas >

    < section id = "animation_control" >

    < p > hover over to start and stop animation. < /p >

    < / section >

    < / section >

    Thanks again for the help!

    -DJ

    Hi DjPhantasy5,

    All the clips on the scene are children of the scene,

    So now the "mouseover" all clips on the stage could be stopped with stop and on the "mouseout/mouseouthandler()" all the children could be restarted with gotoAndPlay like this:

    function Stop()

    {

    If (stage & stage.children)

    {

    var t = stage.children.length;

    for (i = 0; i< l;="">

    {

    child var = stage.children [i];

    If ('stop' in child)

    Child.Stop ();

    }

    }

    }

    function Restart()

    {

    If (stage & stage.children)

    {

    var t = stage.children.length;

    for (i = 0; i< l;="">

    {

    child var = stage.children [i];

    If ("gotoAndPlay" children)

    child.gotoAndPlay (0);

    }

    }

    }

    See http://www.liauw.nl/forums/adobe/djfantasy5/index.html

    But it is also possible to expose "ball1", for example, by adding it to the document.

    This can be done by adding the code for "ball1" as follows:

    / * js

    document.ball1 = this;

    */

    Then stop the animation would look like:

    function Stop()

    {

    If ('ball1' in the document)

    document.ball1.stop ();

    }

    etc.

    Have fun!

    Ronald

  • How to get the main timeline SWF frame rate?

    Sorry for the newbie question...


    How retrieve you the rate for the main timeline that was created when the SWF file was created.


    var en = MovieClip (root) .frameRate


    .. How does not work for me.


    Thanks in advance!

    The frameRate property is part of the scene...

    trace (stage.framerate);

  • slider to control the main timeline

    What code should I take the slider and do control the main timeline? I created a presentation with audio integrated and images coming and to tell the person. I need a way to scrub back to the bottom of the timeline.

    Try the following, where sl is the instance of cursor...

    function moveAlong(evt:Event):void {}
    gotoAndStop (sl.value);
    }

    SL.minimum = 1;
    SL.maximum = this.totalFrames;
    sl.liveDragging = true;
    sl.addEventListener (Event.CHANGE, moveAlong);

  • Control the main timeline and chronology of built-in movie clip

    Good afternoon folks,

    I am trying to solve this problem.  I have a main scenario with an animation. (animation is not a clip).  I also have a clip film embedded in the main timeline. I want to control the actions of the main timeline AND the embedded animation at the same time.

    For example, when a user clicks on a button "pause", I want to stop the animation of the main timeline as well as the integrated clip. I figured out how to stop the main timeline using the stop(); command.  I also understood how to stop the film incorporated using the command _root.embeddedclipinstancename.stop ();  Problem is that I don't know the commands to stop the two things at the same time.

    I tried to find that an instance name for the main timeline, but there is no (I think). I know I could do the animation in the timeline in a clip, but I don't want to go that route.  Any ideas on how to control two things?
    Also, if possible, I would prefer not to use the _root command since I know that this can cause a conflict in Captivate.

    Thank you.

    Include the two commands that worked in your pause button code.  If your [ause button is on the main timeline, you don't need to use a reference of _root.  It is only really useful if you target some of child level object distance back to the main timeline.  You can _parent (and string them if necessary) instead of using _root.  As you will get in trouble unless you're on the _root timeline when using it.

  • Control the main timeline of a movie via a button in a movie on another level.

    Hello!
    I have two film is at two different levels.
    Level 5 is my base film and I load another movie on top of that in level 10.
    Once the user clicks on a button in the movie to level 10, I would like to animation to level 5 to stop (the animation runs on the chronology of the main root of level 5).

    Once the user clicks a different button in the movie to level 10, I would like the animation in the main timeline of the movie in level 5 again from the moment it was already stopped.
    Is this possible?

    It would be great if someone could help me with this.
    Thank you, midi_ie

    You can't delete this loop of onClipEvent (enterFrame) unless you remove the movieclip to which it is attached. However, you can add an else if statement in your code (in addition to checking the variable Boolean "drag") to check if your _level10 button has been activated.

    and you can delete a slider.onEnterFrame loop, but you probably don't want to do.

    p.s. make the loop enterFrame?

  • Button on the main timeline control movieclip

    Hello

    I have a stop in my main script. At the stop, I have a play of movieclip. In the movieclip, I'll have a video playback. After playing the video, I have a button for the user to continue playing until the end of the movieclip. Once the movieclip is done, I want back the return to a specific image in my main script.

    I can't figure out how to make this work. Anyone have any ideas?

    Thanks in advance,

    Paul

    How much of what you just described in currently working properly?

    If it's just the last step to have the game finished main scenario the movieclip, then you might have an event listener assigned to this movieclip in the main timeline.  When the movieclip ends it can send an event of this listener that can trigger an event handler function in the main timeline to tell the main scenario for continued as planned.

    Another less glamorous but more compact approach might be to have a drive inside / at the end of the movieclip to order the main scenario of an act using something like...

    MovieClip (parent) .gotoAndPlay (whatever);

  • Button inside a clip controlling the main timeline

    Hello-

    I have a clip on the main stage - inside that movie clip is a button - I want that button to contol a function on the main timeline.

    example: the Script button

    closeAll_btn.addEventListener (MouseEvent.MOUSE_DOWN, goCloseAll);

    function goCloseAll(e:MouseEvent):void {}


    * do not know what to put here to activate "closeAllOpenMovieClips" on the main stage *


    }

    example: main stadium Timeline Script

    function closeAllOpenMovieClips (): void {}
    trek_mc.gotoAndStop (1);
    lost_arts_mc.gotoAndStop (1);
    rain_mc.gotoAndStop (1);
    vintage_mc.gotoAndStop (1);
    }


    do not know if I need a script more on chronology of main stadium that comes "from function."

    Thank you - Ben L

    If the button is in part 2, then the event listener so that it must be well on frame 2... or you could make the button visible/invisible betrween frames 1 and 2).

    But if you want to head back to your original approach...

    closeAll_btn.addEventListener (MouseEvent.MOUSE_DOWN, goCloseAll);

    function goCloseAll(e:MouseEvent):void {}

    MovieClip (root) .closeAllOpenMovieClips ();

    }

  • Movie Clip on the main timeline to control

    I have a button in a mc and I want that he plays on the main timeline, it does, however, when it gets to the last specified image I want to go to another frame.
    Here's my actionscript I was that day.
    on (release) {}
    _root.gotoAndPlay (75);
    }
    Basically I want all my buttons to play 75 weft, however after each button corresponds to a different image that I need to go to play. 75 frame is essentially a transition to other pages. Each page has the same transition. Any ideas on how to achieve this?

    Well, I have a layer called actionscript, which is for my codes. Where you found other ActionScript where I don't know. But thanks for all your help. Whatever it is, problem solved.

  • Using CS4 Flach and action script 2.0 how to move a specific frame in the main timeline when a movie clip instance come at the end of his chronology?

    Using CS4 Flach and action script 2.0 how to move a specific frame in the main timeline when a movie clip instance come at the end of his chronology?

    code on the last frame of your movieclip instance:

    _root.gotoAndStop ('whatever_frame');  will work unless this swf is loaded into another swf.  in this case, you must use a relative path to the main timeline (for example, _parent or _parent._parent etc.).

  • Recovery of file names on the main timeline in classes

    I have the following code on the main timeline. I have soundLoad_mc assigned to the SoundChgUrl class.

    soundLoad_mc.mp3URL = "climbing.mp3";
    soundLoad_mc.swfName = "journey.swf";

    The code below is from SoundChgUrl. The import of mp3URL works. That nomswf does not work - it, throw "1119: access nomswf property possibly not defined through a reference with static type classes: SoundChgUrl.» It's not logical for me.

    package classes
    {
    import flash.display.MovieClip;
    import flash.net.URLRequest;
    import flash.net.navigateToURL;
    import flash.events.Event;
    import flash.media.Sound;
    import flash.media.SoundChannel;

    SerializableAttribute public class SoundChgUrl extends MovieClip
    {
    public var _mp3URL:String;
    public var _swfName:String;

    private var sound: Sound = new Sound();
    private var channel: SoundChannel = new SoundChannel();

    public void SoundChgUrl()
    {
    sound.addEventListener (Event.COMPLETE, soundLoaded);
    }

    public function set mp3URL(value:String):void
    {
    _mp3URL = value;
    Sound.load() (new URLRequest (_mp3URL));
    _swfName = "journey.swf";
    }

    public function set swfName(value:String):void
    {
    _swfName = value;
    }

    private void soundLoaded(event:Event):void
    {
    sound.removeEventListener (Event.COMPLETE, soundLoaded);
    channel = sound.play().
    channel.addEventListener (Event.SOUND_COMPLETE, changeURL);
    }

    private void changeURL(event:Event):void
    {
    Channel.Stop ();
    navigateToURL (_swfName, "_parent");
    channel.removeEventListener (Event.SOUND_COMPLETE, changeURL);
    }
    }
    }

    Click file/publish settings/flash and check "permit debugging".  Repeat the test.

    then copy and paste the full error message and highlight the line of code mentioned in the problematic error message.

  • Switching between external .swfs in the main

    Hello I have a project where I'm loading external .swfs in my main stage.  However at the end of my external .swfs I want to return to the first image of my main .swf.  I used this code MovieClip (root) .gotoAndPlay ("start"); but I get this error

    ArgumentError: Error #2109: frame the beginning label not found in scene 1 scene.

    and I understand why I get the error because the start of frame label is not in this file external flash, it is in the a main. However, I don't know the correct AS3 so that it works correctly. If anyone has any ideas, it would be greatly appreciated. I tried looking for a bit of code, but he could not find sorry!

    Thanks in advance,

    Aaron

    If you use the code on a timeline of movieclip (and this movieclip is on the main timeline of the external swf file), use:

    MovieClip (this.parent.parent.parent) .gotoAndPlay ("start");

    PS you can save this fla, and publish a swf from this fla file, but you can not 'test' this fla as a stand-alone.  you will test after loading in another swf.

Maybe you are looking for