Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Actionscript: Pass target and page as parameters.

Posted on 2003-10-28
5
Medium Priority
?
167 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:Calron
ID: 9639899
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 500 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

Hire Technology Freelancers with Gigs

Work with 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

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

610 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