A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Passing variables between 2 movies

  1. #1
    Senior Member RazoRmedia's Avatar
    Join Date
    Oct 2000
    Location
    UK
    Posts
    3,016
    I have searched and searched but to no avail.

    I need to pass a single variable from one flash movie to another. they are both on seperate html pages. I have done this before using ASP and I know it can be done with most other backend languages too. The trouble is I am limited by the clients crap intranet.

    I have html, flash and javascript at my disposal. Anyway it can be done ?


  2. #2
    Senior Member
    Join Date
    Jul 2000
    Location
    Not on the dole any more
    Posts
    1,040
    Do you want to go from one movie to another, passing a variable to the second when it loads, or pass a variable from one active movie to another active movie?

  3. #3
    Poof! Whaddya need? I'mFine's Avatar
    Join Date
    May 2001
    Posts
    345

    per MusicMan

    Razor;

    I'm HUMBLY submitting a response. I know from reading your posts that you're very knowledgeable, but I'm hoping I can help.

    MusicMan helped me with this same issue before, and here's what I ended up with. I was sending from an HTML page, a topical index that linked to specific frames in my distance learning app. The tag looked like this:

    <A HREF="../module03/final/module03.html?myLesson=m03_l05.swf&myFrame=7">

    On the HTML page that had the swf embedded, I had to change the object tag as follows:

    <script LANGUAGE="JavaScript">
    <!--
    document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" ID=module03 WIDTH=800 HEIGHT=475> <PARAM NAME=movie VALUE="module03.swf'+location.search+'"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#CCCC99> <EMBED src="module03.swf'+location.search+'" quality=high bgcolor=#CCCC99 WIDTH=800 HEIGHT=475 swLiveConnect=true NAME=module03 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT>');
    //--></script>

    I really hope this helps.

    --Rissa

  4. #4
    Senior Member RazoRmedia's Avatar
    Join Date
    Oct 2000
    Location
    UK
    Posts
    3,016
    I'mFine, Stickman

    thats helpful in a way but what I need to do is basically this:

    I have a movie ast in a normal html page. it uses a geturl to load another html page which contains a completely different flash movie. the problem I want is that there is a vertical scroller on this second movie that has the following code:

    Code:
    onclipevent (load){
    _root.newposition = 300;
    }
    what I want is something along the lines of
    Code:
    onclipevent(load){
    if (passedvar == "true"_{
       _root.newposition = 0;
       }else {
       _root.newposition = 300;
    }
    basically, the movieclip is set to a different position depending on a variable passed to it. So if we came from url a for example, the start position of the mc would be 300 whereas if we came from url b, the start pos of the mc would be 0.

    I'm not sure of how to go about this. i will try i'fines example but using a geturl instead of a html anchor.

    cheers for the replies anyway?

    you got any ideas stickman
    [small]you whore!!![/j]



    Bruce

  5. #5
    Poof! Whaddya need? I'mFine's Avatar
    Join Date
    May 2001
    Posts
    345

    getURL

    yeh, that's what I was thinkin', use getURL in place of the HTML tag. You should still be able to pass the variable(s) that way. Then the documentwrite bit should catch the variable(s) so your next movie can use it.

    If Musicman is around today, I expect you'll get some better insight. W? You here?

    --Rissa



  6. #6
    Senior Member
    Join Date
    Jul 2000
    Location
    Not on the dole any more
    Posts
    1,040
    From the sound of it, the URL encoding with getURL should be exactly what you need. Just append the value to the URL of the file, for example:

    Code:
    getURL("myfile.swf?menuPos=300")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center