Solved

Actionscript: Pass target and page as parameters.

Posted on 2003-10-28
5
153 Views
Last Modified: 2010-04-03
I have an intro flash which I would like to use on multiple pages.  I would like to pass the target and the page name so I can use the same flash on all the pages.  When the flash intro is complete, it would forward to the page and in the frame specified.

Thanks!
Doug
0
Comment
Question by:coders4hire
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:Calron
Comment Utility
0
 
LVL 27

Expert Comment

by:negatyve
Comment Utility
0
 

Author Comment

by:coders4hire
Comment Utility
Calron,
The FlashVars seem to be it - but I don't know how to code it in the swf.  I will read on, though.  I don't see the javascript example showing it.

negatyve,
This only appears to be 6 buttons coded to different frames... not passed to the swf as a parameter.
0
 
LVL 27

Expert Comment

by:negatyve
Comment Utility
>not passed to the swf as a parameter.

actually they are. if you click on the button with the label "Frame 5", you will see the url in the address bar:

http://flash-mx.html.it/guide/swf/negatyve_javascript/gotoFrameURL/filmato.html?frame=5

as you can see, frame is passed as a variable via http url.
then this variable is passed to flash via javascript:

+ '<EMBED src="filmato.swf' +document.location.search+'" '

and read inside flash:

gotoAndStop(Number(frame));

Have you downloaded the example source?
0
 
LVL 5

Accepted Solution

by:
Calron earned 125 total points
Comment Utility
Well, what you do is add the flashvars part to your html tags where you embed the swf (i usually go for both ways, adding it in the embed and as a separate param tag). That way it should work for both IE and other browsers.

lets say you have this:

<PARAM NAME=FlashVars VALUE="foo=Hello%20World&paragraph=first+line%0Dsecond+line">

you will have two variables available in your main timeline names foo and paragraph. Just check their content and react to it.

The javascript example uses this function found in flashpage.htm to pass a variable to the swf:

function setPage(newPage) {

      //check if Flash object exists
      if (window.document.mymovie) {
            //set page variable in _root timeline of Flash movie
            window.document.mymovie.SetVariable("page", newPage);
      }
}
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now