dcsimg
A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: How to get pass data from the HTML to the Flash movie?

  1. #1
    Junior Member
    Join Date
    Mar 2002
    Posts
    9

    How to pass data from HTML to the flash movie??

    I have this navigation menu in flash, and its the same for like 15 html.
    What I want to do, is acording to diferent HTML's I change the status of the movie.

    Like in HTML_1 it should begin playing in frame 1,
    and so on..

    How to do this??

  2. #2
    I actually have a more dierect question that might help you cause.
    Is there a way for an swf to read in the query string or the path of the page that it is curently in?

    If so then this would be a very easy task, all you would have to do is read the path, or the querry string and act accordingly.

    If not then you would have to use a scripting language in order to store the users position and then throw it back into flash.

  3. #3
    Junior Member
    Join Date
    Mar 2002
    Posts
    9
    Originally posted by enamics
    I actually have a more dierect question that might help you cause.
    Is there a way for an swf to read in the query string or the path of the page that it is curently in?
    I think so..
    It like this..
    The navigation movie its like and explorer, you know, the tree format.
    But I cant use frames, so each time I load a diferent page the movie reloads right?

    What I want to do is somehow tell the movie in which state he was in because he was reloaded.

  4. #4
    Senior Member
    Join Date
    Jun 2000
    Posts
    705
    You can use cookies to store a variable like the page number. Then have flash read the cookie to decide what to do.
    You can use PHP or javascript to set cookies, maybe some other languages too.

  5. #5
    Junior Member
    Join Date
    Mar 2002
    Posts
    9
    Sorry, no cookies allowed .

  6. #6
    Senior Member
    Join Date
    Jun 2000
    Posts
    705
    aw man... that makes it a pain. you would need to send the variable to the url and read it then. You can see an example above in the url using "POST":
    ?threadid=291200
    I never use this though so I'm not sure how to read it back into flash.

  7. #7
    Junior Member
    Join Date
    Mar 2002
    Posts
    9
    And thats why I want help...
    I can think of two things..
    Either "?xpto=1234" in the URL, or
    Javascript on the page.

    But either way I dont know how to read it on the Flash movie..

  8. #8
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Using one of the Flash methods:

    GotoFrame, SetVariable or others...

    http://www.macromedia.com/support/fl...hflash_03.html

    http://www.macromedia.com/support/fl...cript_comm.htm

  9. #9
    Junior Member
    Join Date
    Mar 2002
    Posts
    9
    Thank you so much..

    Really!

  10. #10
    Retired Mod aversion's Avatar
    Join Date
    Jun 2000
    Location
    insomnia
    Posts
    7,917
    if you just have an swf navigation on different html pages the easiest way to pasds a variable into the flash is to hardcode it into the flash embedding.

    for example:

    you want to pass the value of 'yourVar' into the swf on each page.

    in the embed code of the 'home' page write:
    <*param name=movie value="your.swf?yourVar=home">
    and
    <*embed src="your.swf?yourVar=home"......

    and flash will be able to read that variable in the root.

    and simply change that variable on each page you have, so the 'aboutus' page wouldpass 'aboutus' etc.

    easy as pie

    leave out the *




  11. #11
    Senior Member
    Join Date
    Jun 2000
    Posts
    705
    damnnnn aversion
    i didn't know you could just embed variable like that.
    That just oped all kinds of possibilities with php and javascript for me . Custom flash pages made on the fly.
    Thanks

  12. #12
    Retired Mod aversion's Avatar
    Join Date
    Jun 2000
    Location
    insomnia
    Posts
    7,917

    i use the exactly the same system but using php to enter the variables depending on user inputs If you have php on your server it's the simplest thing in the world to do this dynamically.

    many different uses.

    there are more complex ways to pass data to an swf in real time, i remember swampy has a good tute on his site, i'll see if i can dig it up.






  13. #13
    Junior Member
    Join Date
    Mar 2002
    Posts
    7

    Lightbulb @aversion

    Hi,
    thanks for that comment....it's very usefull for me...
    regards
    Rudolf

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