Hello,
I'm working on making some buttons read a variable that I have set, that's not really the important part so I'll make it simple.
scene = 1;
Scenename = "Scene " + scene; //something like this
gotoAndPlay(Scenename,1);
I get the error that I need to define a string for the Scene on the gotoAndPlay statement. How do I get around that so I can use the variables that I set?
First, you shouldn't be targeting scene names, but labeled frames instead...
Just label the targeted frame in whatever scene or whatever timeline, with an unique label such as my_target1 (no number only labels, or at least not starting off with a number, no caps, no spaces, no other special characters other than the underscore...), add _root or _level0 to your path to target the main timeline, and target the labeled frame on your scripts...
_level0 is basically the same as _root when a button is within a movie clip, but would expressly need to be used if the button was in an external movie loaded on another level.
If it's not working for you, then you've got something else wrong!
It seems it works without inserting the scene name too as oldnewbie says. I didn´t know/understand that. So just use this code:
code:
on (release) {
_level0.gotoAndStop(_global.frame_to_go);
}
Define the variable as stated ealier in the thread in the start of your movie. I have attached a working file in MX format.
(Sorry about giving wrong advice oldnewbie.)
Okay cheers! I don't *quite* understand all this variable stuff, but that's something I'll have to look into, eh?!
I've only got one more problem (), and that's when I click the button, it locks onto the first frame of the scene, and nothing plays. I've tried moving the 'my_target1' around, but it doesn't show any movement - it's just locked on.
I'm thinking that there's something simple I should be doing.
Any answers?
(btw, cheers again guys! )
P.S, this isn't relative to the topic, but my pixel fonts, on some selected sentences are blurry, even though they're all size 8. It's happening on all 3/4 of them, any idea? (For reference, they're Pixel08, SquareDance and fixed01...).
Several other restrictions on the use of pixel fonts...
Textfield must not have been scaled, must be 100% across in the Transform panel...
Text must be left justified only...
If the textfield is nested in movie clips, they must also be on exact pixel value coordinates, and must not have been scaled either.
Dynamic text cannot be full justified, if that's what you really mean. Even more so when using a pixel font.
You can use spaces to justify each line of text yourself in the text file...
Or you might try the somewhat method in this thread, but don't think that would work with a pixel font...
It's not dynamic, just static. And I'm trying to make the text not blurry, which it goes when justified. There must be an easier way the just spacing it out, surely.