Jump to content

Using a Flash Variable in a gotoAndPlay command


Recommended Posts

Hi,

 

I am using a flip book in a flash movie. I have another movie which stores printable versions of all of the pages. When the user clicks on 'print page', I want my print movie to go to a specific frame label to print the currently viewed page. I am puttign the currently viewed page in a variable called page_to_print, like so:

 

var page_to_print = 'p'+myBook.rightPageNumber

 

This bit works fine, as I've displayed the variable in a text field (above would display p0)

 

The problem is, when I try and use the variable in a gotoAndPlay label command, it doesn't work:

 

gotoAndPlay('page_to_print');

 

Does anyone know why? Is it searching for a label called page_to_print, rather than its value, p0?

 

Thank you in advance.

Link to comment
Share on other sites

I think I should simplify what I’m trying to achieve.

 

Rather than do this:

 

gotoAndPlay(‘test_label’);

 

How do I do it with a variable? What I am using (below) doesn’t seem to work.

 

var my_label = ‘test_label’;
gotoAndPlay(‘my_label’);

 

I think the timeline is searching for a label called my_label, rather than the value of this variable.

 

Thank you.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.