all groups > flash actionscript > october 2005 >
You're in the

flash actionscript

group:

gotoAndPlay to main swf from loaded swf


Re: gotoAndPlay to main swf from loaded swf Motion Maker
10/17/2005 7:12:01 PM
flash actionscript: Included AS files should only be included when published and not at run
time.



--
Lon Hosford
http://www.lonhosford.com
May many happy bits flow your way!
[quoted text, click to view]
In my movie i make a sub mc and load a swf into it. This loaded swf gives
you
a choice to purchase stickers and has a back button on it that (should) take
you to the main swf at the frame labeled "previewFront." Now "preview
Front"
has already run once in the program. When you go "back" you are in fact
running it again. I put a trace in the code that is #included at this frame
when the program loads. The goto, however, never reaches it.

The trace "this is nav101" works so I know the button is active and this
script is executing.

//------------------------------ back button action
----------------------------
_root.mc_holder.btn_Nav101.onRelease = function() { // if the back button
is
pressed

//--------------------- move sticker options out of visual range
for (var i = 1; i <= Number(Account_txt.No_of_Sticker_Types); i++) {
_root.mc_stickerHolder["Sticker" + i]._x = 1000;
}
_root.fn_clearScreenText(); // remove screen text
trace("this is nav101");
_root.gotoAndPlay("previewFront");
}

Any help apprecaited.

Re: gotoAndPlay to main swf from loaded swf Motion Maker
10/17/2005 8:58:49 PM
Yes you can go this route. I have created dynamically loading AS by placing
it in external swf files and loading on demand. Of course you can use
#include in the external swfs or place code in IDE as you please.

Now the problem comes of timing in data communications. You cannot use the
code in the external swf until the frame that has it is fully loaded.

So you need to detect that in the parent movie either by having the external
swf setting a value inside a timer in the parent or the parent with a timer
polling the external swf for a value or use something like the
MovieClipLoader class.

Also you may want to optionally prevent reloading the external swf more than
once if you want using a variable array of loaded external swfs.

Hope this makes some sense if not ask again.

--
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
[quoted text, click to view]
At the risk of sounding really dumb...... the as files in the loaded swf
are
compiled into the swf before it is called by the parent movie. I would put
the
code right into the label frame itself - do you think this would make a
difference? I would think the #include would have taken care of this when
the
child swf was compiled into a swf.

Your thoughts?

gotoAndPlay to main swf from loaded swf bderber
10/17/2005 10:13:51 PM
In my movie i make a sub mc and load a swf into it. This loaded swf gives you
a choice to purchase stickers and has a back button on it that (should) take
you to the main swf at the frame labeled "previewFront." Now "preview Front"
has already run once in the program. When you go "back" you are in fact
running it again. I put a trace in the code that is #included at this frame
when the program loads. The goto, however, never reaches it.

The trace "this is nav101" works so I know the button is active and this
script is executing.

//------------------------------ back button action
----------------------------
_root.mc_holder.btn_Nav101.onRelease = function() { // if the back button is
pressed

//--------------------- move sticker options out of visual range
for (var i = 1; i <= Number(Account_txt.No_of_Sticker_Types); i++) {
_root.mc_stickerHolder["Sticker" + i]._x = 1000;
}
_root.fn_clearScreenText(); // remove screen text
trace("this is nav101");
_root.gotoAndPlay("previewFront");
}

Any help apprecaited.
Re: gotoAndPlay to main swf from loaded swf bderber
10/18/2005 12:02:37 AM
At the risk of sounding really dumb...... the as files in the loaded swf are
compiled into the swf before it is called by the parent movie. I would put the
code right into the label frame itself - do you think this would make a
difference? I would think the #include would have taken care of this when the
child swf was compiled into a swf.

Your thoughts?
AddThis Social Bookmark Button