dcsimg
A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: loadVariables

  1. #1
    Junior Member
    Join Date
    Jan 2005
    Posts
    7

    loadVariables

    Trying to list the contents of a directory using php and include the list dynamically in flash.

    The script I made works fine in the debugger, but when I run it from my site the files dont show up.

    I can't seem to figure out when the loadVariables is complete?

    Any help/examples appreciated.

    -don

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Simpest thing to do is to set one of the variables that you are retrieving to an empty string or 0 and then just keep checking it till it changes.

  3. #3
    Junior Member
    Join Date
    Jan 2005
    Posts
    7
    Originally posted by blanius
    Simpest thing to do is to set one of the variables that you are retrieving to an empty string or 0 and then just keep checking it till it changes.
    Well thats what I am doing...

    element ("sometext").text = root.files;
    if (root.files) { root.doshowpics(); }

    files is the number of files returned by the php script I am calling... the above code works fine in the debug... however when exported as swf "files" never gets filled?

    What am I missing ?
    -don

  4. #4
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    on the surface this looks ok..

    Why are you using root. unless you are testing from within a child you wouldn't need to do that. and if you are testing from within a child you might try testing from within the root movie instead.

    Also in 3dfa you don't need to fill a text box the way you are doing. You can just assign the textbox the to the variable files and it will always update when files changes.

    You might also try testing with
    if (files<>"") instead

  5. #5
    Junior Member
    Join Date
    Jan 2005
    Posts
    7
    Originally posted by blanius
    on the surface this looks ok..

    Why are you using root. unless you are testing from within a child you wouldn't need to do that. and if you are testing from within a child you might try testing from within the root movie instead.

    Also in 3dfa you don't need to fill a text box the way you are doing. You can just assign the textbox the to the variable files and it will always update when files changes.

    You might also try testing with
    if (files<>"") instead
    I did the 'root' as my last failed attempt... The following works in the previewer, but still doesnt work in ie preview or my site...

    element ("sometext").text = files;
    if (files) { doshowpics(); }


    If ya like I can package up the whole thing and let ya peek?

    -don

  6. #6
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    yea send it along to me at bret@3dfa.com

    also you might want to sent it to support@3dfa.com as well.

  7. #7
    Junior Member
    Join Date
    Jan 2005
    Posts
    7
    Originally posted by blanius
    yea send it along to me at bret@3dfa.com

    also you might want to sent it to support@3dfa.com as well.
    Sent... Thanks for the help!

  8. #8
    Senior Member kusco's Avatar
    Join Date
    Nov 2001
    Posts
    681
    flashdon,

    If you do send the file on to 3DFA support please send it to help@3dfa.com as the support email address is no longer used due to the vast number of email viruses received.
    Cheers,
    kusco
    (3DFA Support Team)

  9. #9
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Oh man I hate to tell you but it's not working on export because my split function doesn't work on export..

    Kusco and I have come up with a better function I just haven't shared it yet.

    Actually I'm still having problems with this code
    Last edited by blanius; 01-24-2005 at 10:34 AM.

  10. #10
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Ok here's what I think....

    The current split function won't work in preview and the loadvariables won't work across domains (I think)

    Not to mention that if you have XP sp2 you must manually add the "mark of the web" workaround to allow local use of active x

    <!-- saved from url=(0014)about:internet -->

  11. #11
    A Senior Newbie - How Odd ForumNewbie's Avatar
    Join Date
    Mar 2003
    Posts
    590
    Have you tried:

    element ("sometext").movie.text

    instead of

    element ("sometext").text

    ?

    I'm away from my PC at the moment so can't test anything, but I've found differences between preview and export if you don't do that.

    Morgan
    Please note that my domain has changed to http://www.morganmultinational.com

  12. #12
    A Senior Newbie - How Odd ForumNewbie's Avatar
    Join Date
    Mar 2003
    Posts
    590
    In fact, if you neglect the thing about doing loadvariables across domains, that's exactly the problem I've seen many times. (See the 'Button Question (Quick one I hope)' thread for reasoning)

    If an element has properties enabled, then to access the variables or change the variables within that element, you need to use element("elementname").movie.variablename . It always appears OK in 3DFA though if you forget the .movie part.

    I may be completely off the mark, but this sounds sufficiently similar to be worth trying this first.

    Hope this helps,

    M.
    Last edited by ForumNewbie; 01-25-2005 at 01:00 AM.
    Please note that my domain has changed to http://www.morganmultinational.com

  13. #13
    Junior Member
    Join Date
    Jan 2005
    Posts
    7

    Partial Success -- root.files retrieves the count properly...

    I had to add the ",0" to loadvariables...

    The Element "sometext" is updated properly with the files var value... if I remove the "return" flash hangs and eventually complains the script is running to slow and asks to cancel.

    Blanius.. I renamed your split script to splitit, same code as before.. just clarifying I wasn't clashing with a builtin .swf function..

    Seems the split function is now failing?

    -don


    #The child layer button script is as follows..
    if (root.files>0) { root.doshowpics(); }

    # Main Movie Startup script.
    files=0;
    loadVariables("http://www.mirc-script.com/test/test.php",0);

    //**************************************************
    // Script to display pictures from retrieved from php script
    // myfiles is retrieved from loadvariables
    // files is retreived from loadvariables
    // all files im myfiles var are delimited by |
    //**************************************************
    function doshowpics()
    {
    element ("sometext").text = "Loaded... " + root.files;
    return;
    myarray = new Array;
    y = 50; s = 12; x = 150;
    myarray = root.splitit(myfiles,"|");
    for (n = 0; n <= myarray.length - 1; n++)
    {
    myelem = element("sometext");
    mynew = myelem.clone();
    y+=s;
    if (y > 400)
    {
    y = 50; x += 200;
    }
    mynew.x = x;
    mynew.y = y;
    mynew.text = myarray[n];
    }
    }

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