#16
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    25
    Rep Power
    0
    can i bring up the output box from the flash movie without doing the 'test'?

    test doesnt want to grab the data from my asp page. I guess i could make it a text file instead, until i get it working...
  2. #17
  3. No Profile Picture
    flash junkie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    CO, USA
    Posts
    172
    Rep Power
    12
    unfortunately the output window is restricted to within Flash... you can use getURL to alert a variable from within Flash if you want... If you know which .asp file outputs this variable though, you can easily tell where the path should be...
  4. #18
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    25
    Rep Power
    0
    made static copies of my data sources to i can test.

    Ok. confused again!
    This code at the top of my pulldown:

    this.loadvariables("flashagenttable.txt");
    trace("the variable is on the movieclip: "+this.CurrentAgentNumber);
    trace("the variable is on the _level0 or _root:"+_level0.CurrentAgentNumber);
    trace(_root.CurrentAgentNumber)
    trace(CurrentAgentNumber)


    returns this in the output box:

    the variable is on the movieclip:
    the variable is on the _level0 or _root:
    undefined
    undefined

    Almost like its not seeing the variable at all, yet this:

    _root.CurrentAgentNumber

    in the variable field of my textbox populates the textbox with the correct value. What am i missing here?!!!
  6. #19
  7. No Profile Picture
    flash junkie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    CO, USA
    Posts
    172
    Rep Power
    12
    getURL("javascript:alert('"+this.CurrentUserAgent+"');");
    getURL("javascript:alert('"+_root.CurrentUserAgent+"');");
  8. #20
  9. No Profile Picture
    flash junkie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    CO, USA
    Posts
    172
    Rep Power
    12
    in that particular code, it's looking for the variable and tracing the values before the data has a chance to get loaded in (even locally)...
  10. #21
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    25
    Rep Power
    0
    yup.. i was just going to post that i put:
    trace("the variable is on the movieclip: "+this.CurrentAgentNumber);
    trace("the variable is on the _level0 or _root:"+_level0.CurrentAgentNumber);
    trace(_root.CurrentAgentNumber)
    trace(CurrentAgentNumber)
    trace(curagt)

    on a button which returns:

    the variable is on the movieclip:
    the variable is on the _level0 or _root:0615
    0615
    undefined
    undefined

    OK. so let me get this clear.
    should I load my variables in frame 1, and have my controls in frame 2? Because it looks like im trying to evaluate a variable before its been defined (remember i'm new to this flash!!)
  12. #22
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    25
    Rep Power
    0
    Do layers make a difference as well?
  14. #23
  15. No Profile Picture
    flash junkie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    CO, USA
    Posts
    172
    Rep Power
    12
    well if your CurrentUserAgent variable is loaded in on your movieclip (i think it's on the scrollbar) then your onClipEvent(data) takes care of the waiting... what it does is evaluates when a data stream has been completely loaded into whatever movieclip the onClipEven exists on. That's what you'll need to create (it's called an onData event handler). If you're using Flash MX, i would use the new LoadVars object like so:

    Code:
    myLoader = new LoadVars();
    myLoader.onLoad = function(){
    	trace("data loaded");
    	trace(this.CurrentUserAgent);
    }
    myLoader.load("mydata.txt");
    when you create a LoadVars object, all of the variables lie within the myLoader Object. it's a change of approach, but if you can use MX code, i would suggest you use the LoadVars object. It helps you organise where your variables are, and you don't need onClipEvents any more... Also, you don't have to do frame checks (like you're proposing). The problem with evaluating on the 2nd frame is that the variable might not always be loaded by then (especially live with .asp pages). If you use LoadVars, you can set up the onLoad function to process the variables and it will only run once the data is actually loaded.. i can post a simple LoadVars example, if you want.

    cheers,

    bret
  16. #24
  17. No Profile Picture
    flash junkie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    CO, USA
    Posts
    172
    Rep Power
    12
    and layers make absolutely no difference... They are the authoring stacking order, but the depth (or z-index) can be changed at run time using swapDepths(target)
  18. #25
  19. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    25
    Rep Power
    0

    Question


    Would loadvars replace the code for loading the data for the combo box as well? Would i put it on the frame or on the combo box... I think its time to buy that book on Flash MX...
  20. #26
  21. No Profile Picture
    flash junkie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    CO, USA
    Posts
    172
    Rep Power
    12
    heeh right, LoadVars should be put on a frame, and could replace both the loadVariablesNum and loadVariables on your ClipEvents... the only difference would be that you would have to target your movieclip where you want all the things to happen as opposed to an onClipEvent, where the actions happen to the clip it's attached to. i must say, you're tackling a pretty heavy subject for only learning Flash days ago

    i find that the actionscript reference does a wonderful job explaining what most of the code does... but if you are looking for Flash books that cover dynamic data generation/manipulation/server side integration, i would check out Flash MX Applications by the Friends of Ed. Although their parent company recently went down, their books are great! and they have a really strong support forum(who knows for how long though...)

    cheers,

    bret
  22. #27
  23. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    25
    Rep Power
    0
    if you could throw together a small sample of how loadvars would work, i would be extreamly greatful.
  24. #28
  25. No Profile Picture
    flash junkie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    CO, USA
    Posts
    172
    Rep Power
    12
    sure, here's a small example of using a LoadVars object to load in from a text file. notice i'm setting a variable on the _root timeline equal to the variables from the text file. If i didn't do this, i'd have to refer to myLoader before i got the the loaded variables. If you run the movie, you'll notice that the first output is "undefined". This is because the variables haven't loaded yet, but once they load, it displays the right thing. So, here's a couple of things to keep in mind when using LoadVars

    it's an Object, so it can have properties (and is basically indexable like an associative array with dot or bracket notation)

    any variables that get loaded into the object can (using .load) be accesed be first referencing the LoadVars object itself.

    you can specify where you want the variables to load into by using sendAndLoad (but i haven't done that for simplicity's sake)

    the LoadVars object has a built in handler called onData that determines when the data stream has been completely loaded

    check out the file and write back with questions

    cheers,

    bret
    Attached Files
  26. #29
  27. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    25
    Rep Power
    0

    Angry loosing my hair over this...


    If i define a variable in code on the frame , then at what point does the variables become usable? It seems that they are unavailable when im trying to use them. i'm just not getting this!

    Its hard to get me mindset off VB\ASP coding.
  28. #30
  29. No Profile Picture
    flash junkie
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    CO, USA
    Posts
    172
    Rep Power
    12
    well, when you're loading the variables in from an external source, the variable becomes defined (and usable) the moment. Otherwise, it's available right after you declare it...

    the only time that you should have issues with availability of variables is when you are loading them in. Otherwise, it's guaranteed to be either a naming or a pathing problem...

IMN logo majestic logo threadwatch logo seochat tools logo