Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 27th, 2003, 09:56 AM
jmichels's Avatar
jmichels jmichels is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Orlando, FL
Posts: 177 jmichels User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 18 m 12 sec
Reputation Power: 6
Recognizing Variables

When I load variables from a text file into my Flash movie, it works properly. But when I try to set up "If" conditions based upon the variables, it fails to read them correctly and I have to manually type the variables in.
Is there any way to fix this? All help is much appreciated.

Reply With Quote
  #2  
Old February 27th, 2003, 11:20 AM
bret bret is offline
flash junkie
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: CO, USA
Posts: 172 bret User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 38 sec
Reputation Power: 6
Send a message via Yahoo to bret
do you have an example of your code? how you access the variables depends on how you loaded them in.

bret

Reply With Quote
  #3  
Old February 27th, 2003, 02:04 PM
jmichels's Avatar
jmichels jmichels is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Orlando, FL
Posts: 177 jmichels User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 18 m 12 sec
Reputation Power: 6
re: Variables

Hello,

Thank you for your assistance. It was very strange... When I started to build a working example to show you... It actually worked. The one that I am having difficulty with is the calendar at www.thedarkcontent.com because it refuses to respond to the "If" conditions based upon the text file variables. I have included an fla to show you what I was having problems with.

Sincerely,
Jamie Michels
Attached Files
File Type: zip variables.zip (3.9 KB, 323 views)

Reply With Quote
  #4  
Old February 27th, 2003, 02:08 PM
jmichels's Avatar
jmichels jmichels is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Orlando, FL
Posts: 177 jmichels User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 18 m 12 sec
Reputation Power: 6
Oops... I made a mistake. The file that I posted does not work properly. It too, does not act upon the conditions that I specified. It should go to and stop on keyframe 2, but it refuses.

Reply With Quote
  #5  
Old February 27th, 2003, 03:40 PM
bret bret is offline
flash junkie
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: CO, USA
Posts: 172 bret User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 38 sec
Reputation Power: 6
Send a message via Yahoo to bret
i think that your problem has to do with pathing. in your text file, you have "&_root.variables=Loaded" when you probably shouldn't assign the path of the variable in the text file (in fact, it was most likely the main problem).

when you say loadVariablesNum("variables.txt",0);, you are telling flash to load all of the variables into the _level0 timeline. this means that whatever variables are present in your text file, will now exist in whatever object you loaded them in to (our object just happens to be _level0; you can load them into movieclips, timelines or _levels.) So i changed the text file to "&variables=Loaded" and then changed your script in the first frame to:

PHP Code:
//actionscript
loadVariablesNum ("variables.txt"0);
this.onEnterFrame = function ()
{
    if (
variables == "Loaded") {
        
gotoAndStop (2);
        
delete this.onEnterFrame;
    }
};
stop (); 


notice i also put an onEnterFrame function to it, and changed "eq" to "==" (eq is deprecated now...) So, because i'm on the _level0 timeline, i don't need to reference anything but "variables". Once it's loaded, i kill the onEnterFrame function and then it goes to the next frame fine.

the reason that we need the onEnterFrame function is, even when we play the file locally, it still doesn't get loaded in fast enough for just one check of if(variables=="Loaded").. so we need to check it until it resolves. hope that helps.

cheers,

bret

Reply With Quote
  #6  
Old February 27th, 2003, 04:37 PM
jmichels's Avatar
jmichels jmichels is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Orlando, FL
Posts: 177 jmichels User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 18 m 12 sec
Reputation Power: 6
Bret,

Thank you very much for helping me! Your actionscript totally fixed the issue and I appreciate it.

Sincerely,
Jamie Michels

Reply With Quote
  #7  
Old February 27th, 2003, 04:58 PM
bret bret is offline
flash junkie
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: CO, USA
Posts: 172 bret User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 38 sec
Reputation Power: 6
Send a message via Yahoo to bret
glad i can help

Reply With Quote
  #8  
Old March 3rd, 2003, 03:35 PM
Den Den is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 2 Den User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
bret,

I have a similar problem . I have 2 frames flash movie and a data.txt file that contains data. I want to load all data in the data.txt file in the first frame and then go to second frame. But I want to be sure that all data is loaded before going to the second frame.

my data.txt file:

&url1=http://www.trgamer.com
&url2=http://www.shockhaber.com

frame 1:
PHP Code:
 myVars = new LoadVars();
myVars.onLoad = function(success){
    if(
success){
        
trace("variables loaded successfully");
        
gotoAndStop(2);
    } else {
        
trace("something went wrong...");
    }
}
myVars.load("data.txt");
stop(); 


frame 2:
PHP Code:
 getURL(url2"_blank"); 


I expect trgamer.com open in a new window but it doesn't.
Another problem is I can't use the variables in the data.txt file.
For example :

PHP Code:
 myDynamicText.text url2


myDynamicText is dynamic text field. and it should have the text "http://www.shockhaber.com" but it hasn't

can you help me about this?

thank you,
Den
Attached Files
File Type: zip load.zip (2.3 KB, 323 views)

Reply With Quote
  #9  
Old March 3rd, 2003, 03:52 PM
bret bret is offline
flash junkie
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: CO, USA
Posts: 172 bret User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 38 sec
Reputation Power: 6
Send a message via Yahoo to bret
your problem seems to be much more straight forward after looking at how you loaded your variables, you just need to make sure that you refer to your LoadVars object. So, all you need to change is :

mytext.text = myVars.url2;
getURL(myVars.url2, "_blank");

Because the variables that you loaded in, actually reside in the object that you loaded them in to. Your LoadVars object was called "myVars" so in order to access the variables from the text file, you need to say "myVars.url2"... hope that helps.

cheers,

bret

Reply With Quote
  #10  
Old March 3rd, 2003, 04:29 PM
Den Den is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 2 Den User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
bret, thanks for the quick answer

I was struggling with this for days

Reply With Quote
  #11  
Old March 3rd, 2003, 04:55 PM
bret bret is offline
flash junkie
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: CO, USA
Posts: 172 bret User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 38 sec
Reputation Power: 6
Send a message via Yahoo to bret
glad i can help (assuming it works.. which it was working when i tested it

bret

Reply With Quote
  #12  
Old March 12th, 2003, 03:03 PM
justpancho justpancho is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: Valdosta, GA
Posts: 4 justpancho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
you probably already answered this...

but i'm too stupid to make this work. please help *begs*

okay i'm using flash 5. i simplified my problem down to the bare essentials so that the flash file would be easy to read. okay here is what i've been doing.

i create a text file named "text.txt". inside the text file i have put (on the top line)

Version one: boo=carnival
Version two: &boo=carnival
Version three: boo=carnival&

I have tried all three of these but none of them seem to work.

okay in my flash movie. on the first frame i put the action:

loadVariablesNum ("text.txt", 0);

Reply With Quote
  #13  
Old March 12th, 2003, 03:04 PM
justpancho justpancho is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: Valdosta, GA
Posts: 4 justpancho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
continued

on the fourth frame i have the action:

if (boo == "carnival") {
gotoAndPlay (10);
}

Reply With Quote
  #14  
Old March 12th, 2003, 03:08 PM
justpancho justpancho is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: Valdosta, GA
Posts: 4 justpancho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
still continued (why is it cutting off my message?)

on the fifth frame is the action: "stop ();"
on the tenth frame is the action: "stop ();"

Reply With Quote
  #15  
Old March 12th, 2003, 03:09 PM
justpancho justpancho is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: Valdosta, GA
Posts: 4 justpancho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
arg .. another continue .. sorry :/

on every frame (1-10) i have put a text box that is just a normal text box that only has the name of the frame so i know what frame number the flash movie is stopping on.

then on every frame (1-10) i have put a dynamic text box with the variable: boo

okay .. that is basically the file. the thing that is frustrating me so much is that in the dynamic text box it will fill in the word 'carnival'. so i know that it is opening up the right file and finding the variable for boo. it just wont go to frame 10. i've tried changing it to _root.boo or _level0.boo but these don't work either.

if anyone understands this please help. after 3 agonizing days i'm about to give up

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > Recognizing Variables


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not