Solved

Actionscript: Pass target and page as parameters.

Posted on 2003-10-28
5
155 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
ID: 9639899
0
 
LVL 27

Expert Comment

by:negatyve
ID: 9640367
0
 

Author Comment

by:coders4hire
ID: 9641085
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
ID: 9641111
>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
ID: 9641121
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
3D rotation for a product 3 338
adding child problems - Error #1009 (Cannot access a property or method of a null) 1 521
Array is not working ( AS2 ) 4 152
free flash maker 5 209
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…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

816 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