View Full Version : frameName instead of frame#
I have a working playhead navigation that relies on the frame nr's, but because I expect to be changing the frames a lot during development it would be easier if I use frame names instead. But when I change the frameNr's in my code to the given frame names it stops functioning.
Below is the relevant code, the names ("hover, "rest") were previously frameNr's.
if( ball._visible && ball.hitTest(_xmouse, _ymouse))
if(ball._currentframe == "hover") ball.stop();
else if(ball._currentframe != "rest") ball.play();
01-08-2009, 06:44 PM
_currentFrame returns only the number, so comparing with text will always fail. There is a workaround though.
On the frames "hover, "rest", make a new layer for actions. Then put this code (change the name, but it must be put on any frame you label to access in AS)
this._currentframe = "hover";
Then you code should work...let me know.
That didn't work unfortunatly. :(
01-09-2009, 12:35 PM
AS3 has a property currentLabel which you can use, if you are up to the challenge of making AS3 compliant code.
It seems that AS2 doesn't have anything that really can do this (an oversight on the part of developers), but there are some other ideas. For instance, you could save the labels and frame numbers in an array and then test against that. Therefore any changes you make you only need to change in the array once.
I haven't really looked into AS3 yet, I'm not sure I can use either because I'm publishing as flash 7 to make it compatible with other devices as well.
Thanks for the suggestions though!
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.