Flash - upload movies/AS
- Started
- Last post
- 8 Responses
- hiatus
I need to fix a site i made in flash. I have an ext. swf loading. its jumpy.
when you click on a product on the bottom it reloads and reanimated; other funky stuff. I'm new to working with AS2. Is there a site/link you guys might share with me on the proper way of working with loaded swf files.
I am thinking I need to some code like this that talks to my loaded swf:
on (release) {
if (_root._mc._currentframe == "200") {
_root._mc.gotoAndPlay(some#frame...
} else if (_root.loaded SWF._currentframe == "4") {
_root.loadedMC.gotoAndPlay(some...
}I just need to know how to talk to loaded frames and tell it do nothing or go to this place.
- fyoucher10
For AS2, I've used Greensocks Preload Asset Manager. Nice lil utility that can load whatever kind of file into a queue. You can pause a download, resume, etc etc
Then you can use his load events when stuff is done downloading. See the page, everything is well documented>
- PonyBoy0
what uan said... you need a stop(); at the very beginning of that loaded swf...
also - fyoucher mentioned greensock - this engine will allow you to tween your timeline dynamically... something like this:
TweenMax.to(myMC, .5,{ frame: label } );I advise labeling your frames w/text labels - relying on specific numbers is a pain if you need to go back and update the animation
- fyoucher10
lol. I read your post wrong, sorry bout that. However, you should make sure that you correctly load the items. If I were you, I'd make sure you're using a way of checking if the content is loaded first, either by using a variable (ie. isLoaded == true), using an event handler for loaded assets (ie. onLoadInit, onLoadComplete, etc), or use the nifty lil utility class I mentioned above. You may be calling a loaded asset that's not readily available yet or may be replacing a loaded asset incorrectly and thinking it's there. That's the first part you should take care of.
Now onto targeting your loaded assets.
1. First, to make it easier on your life, get rid of adding code directly to your buttons. You'll make things a lot easier for you plus you won't run into scope problems as much. Especially since you're a newbie.
Give your button an instance name and then on a frame after the button first appears add code like this for the button states:myBtn.onRelease = function():Void
{
//code to do stuff here
}//onRollOver, onRollOut, onPress, etc etc. Same code structure for those event handlers.
2. Make reading your code easier. Make a shortcut to the loaded files assets. So instead of writing externalfile.externalFiles_mc.ch...
etc etc etc
You make a shortcut to reference it.
var myLoadedAsset:MovieClip = loadedMC.nameOfMovieClip;This way if you need to reference that movieclip, you're not writing the entire path to the movieclip everytime. You just use myLoadedAsset.gotoAndPlay("deezn...
Finally, if you did the VERY first part correctly by checking if the content is readily available. Then you can check conditions just like how you're were doing. Except using the current frame of a movieclip is probably not the best way to approach that.
In summary:
- Make sure the content is loaded first.
- Take code off of buttons!
- Create a shortcut to movieclip instances.
- Target those clips however you'd like.
- fyoucher10
The MovieClipLoader Class, just in case you didn't know about it >
http://help.adobe.com/en_US/AS2L…
- hiatus0
fyoucher1 - thanks for the help
my buttons are done made like this. The following are the layres in flash followed by code:
action-stop();
btn-a btn graphic with the code
graphic-a mc with the active/inactive state w/ frame labels or over/out states with frames labeledAlso on the loaded Products.swf page I have the stop(); on all the frames and the frames are labeled with numbers rather then product name.
using classes ads another thing on my plate which I don't understand how to use, but will try to grasp cause they're the "leatherman" in tools to use in AS coding.
Thanks peeps
- are you sure about your stop(); in the very first frame of you loaded swf? 'cause if so, this should not play:
http://allinonecarri…uan - this I mean:
http://allinonecarri…uan
- are you sure about your stop(); in the very first frame of you loaded swf? 'cause if so, this should not play:
- hiatus0
I've got this for my btn:
on (rollOver) {
gotoAndPlay("active");
}
on (releaseOutside, rollOut) {
gotoAndPlay("inactive");
}on (release) {
_root.main_bkgd.gotoAndStop(200...
loadMovie("http://allinonecarrie... "_level1");
_root.onEnterFrame = function(){
_level1.gotoAndStop(3)
}
}should I be using something like this - I don't think the getBytes formula is working:
on (release) {
_root.main_bkgd.gotoAndStop(200...
loadMovie("products.swf", "_level1");
_root.onEnterFrame = function(){
if(_level1.getBytesLoaded()>0 && _level1.getBytesLoaded() == _level1.getBytesTotal()) {
_level1.gotoAndPlay("3")
}
}
}