A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Var Issue "No solution??"

  1. #1
    Junior Member
    Join Date
    Jun 2004
    Posts
    22

    Var Issue "No solution??"

    Hi,
    I would like to start this variables issue, cause i have read a lot of posts with the same problem and all gives the same solution:no solution!
    The problem is that sometimes we can't use the variables in the actionscript, we can use it directly in a dynamic text box, but not in actionscript.I think this problem appears when we call a var from a movieclip or from a external file(like .txt).

    Have this happen to you??
    If yes just tell us your situation and your solution too please ,if you have!!

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    More info is needed!
    Attach a simple .fla replicating your problem, zipped up and in MX only format.

  3. #3
    FK Newb Beater
    Join Date
    Dec 2002
    Location
    Seattle
    Posts
    676
    I second that oldnewbie. It's probably a scope issue. If a var is called from a movieclip by a button on the main stage, it's scope is local to the movieclip and not the main stage unless it is declared first as global. Likewise if a var is called from a text file and loaded into a movieclip, the same will be true.
    Just because you changed the code, doesn't mean it's yours

    Most Recent Work:
    Commercial tanning beds website

  4. #4
    Junior Member
    Join Date
    Jun 2004
    Posts
    22
    Ok
    Here is an exemple, a simple one!
    I created a movieclip(movieclip.swf) that is loaded in main.swf
    movieclip.swf has a var called movie_clip_var
    when movieclip is loaded you can put movie_clip_var in a dynamic text box with this code _root.stage1.movie_clip_var, but if you want to work it in the actionscript the output will be undefined!

    Hope that this exemple ilustrates my issue.
    Thanks
    Attached Files Attached Files

  5. #5
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    These are most probably MX2004 formated .flas... Can't open them. They would have to be saved as MX only format (use Save As and change the document format in the Save as window), so that we still on MX only, can open them.

  6. #6
    Junior Member
    Join Date
    Jun 2004
    Posts
    22
    OK
    Try it now.
    Attached Files Attached Files

  7. #7
    FK Newb Beater
    Join Date
    Dec 2002
    Location
    Seattle
    Posts
    676
    This works when declared in the movie_clip.swf
    code:
    movie_clip_var="This is the movie clip var";
    var_stage1=movie_clip_var+" ,declared in AS of movieclip";
    _parent.var_main = movie_clip_var;

    Just because you changed the code, doesn't mean it's yours

    Most Recent Work:
    Commercial tanning beds website

  8. #8
    Junior Member
    Join Date
    Jun 2004
    Posts
    22
    Yes, that's true it works!
    But you still can't use it in the main.swf actionscript.
    if you wanted to add something to that var you couldn't, unless you do it in the movieclip.swf.
    For exemple, this doesn't workin main.swf)

    var_main=stage1.movie_clip_var+" ,declared in Main";

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