A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Pass variables when loading a swf

  1. #1
    Junior Member
    Join Date
    Oct 2004
    Posts
    15

    Pass variables when loading a swf

    I have two swfs

    one is a log-in gate while the other is a logged screen

    the log-in gate receives a var "username" and passes it to the logged screen

    but the logged screen always displays "undefine"

    i tried many times and yet succeed

    code: loadMovieNum("logged.swf",0);

    does anyone knows what's wrong with it?

    thanks


    lawrence

  2. #2
    Registered User
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    by loading the logged.swf into level 0 you are removing the login.swf and any veriables you set.

    so the username does not exist after login.swf unloads.

    you will need to pass the variable to logged.swf.

    try this:

    // in the same timeline that sets the username variable
    loadMovieNum("logged.swf",0,"GET");

    this should append all variables from the current timeline to logged.swf's url so that when it loads into the player, Flash creates the variables at run time.

    Note that I havent actually tried passing variables between SWF this way, and I am assuming that Flash will create the variables in the new SWF at run time. It may be that the variables just get passed as HTTP name value pairs to the server and Flash does not see them.

    You might want to follow up more with this in the ActionScript forum.

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