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.

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.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.