Flash - upload movies/AS
Out of context: Reply #5
- Started
- Last post
- 8 Responses
- 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.