Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-10-2004, 01:47 PM   #1
violetfemme
Registered User
 
Join Date: May 2004
Posts: 8
Red face dynamic _visible

Hi... New to the boards and I've found them very helpful. There are some great experts here! But I'm trying to do something very similar to what was done in this thread. I've got a state map that has counties that are all movie clips (county001_mc, county002_mc, etc....) And a text document that's formatted "&county1=true&county2=false".

Basically what is going on is that if county1=true, then the movie clip county001_mc needs to be visible. If county 2=false then the movie clip county002_mc needs to be not visible and so on and so on.

I've tried working through the examples in the above thread, but it's just not working. Any help? I'm using Flash MX2004

Thanks in advance!
violetfemme is offline   Reply With Quote
Old 05-10-2004, 02:14 PM   #2
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,106
Default welcome to as[org]

try:
country001_mc._visible=country1;

if your using loadVars() object to load the data into flash, then try:
country001_mc._visible=myLoadVarsObjectInstanceNam e.country1;
__________________
tg
---
what the hell was i thinking?

Last edited by tg; 05-10-2004 at 02:15 PM. Reason: spelling (gotta make sure visible is spelled correctly) hehheh.
tg is offline   Reply With Quote
Old 05-10-2004, 03:00 PM   #3
violetfemme
Registered User
 
Join Date: May 2004
Posts: 8
Default gracias!

Got that logic... hoped it would be that simple! Thanks so much... though I think I'm screwing up the loadVariables now. I can't find any examples that don't include loading the results into a component or text box or something. Any tips?

This forum is for newbies, right?
violetfemme is offline   Reply With Quote
Old 05-10-2004, 03:06 PM   #4
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,106
Default

don't use loadVariables, use the LoadVars() object. its much easier to deal with.
__________________
tg
---
what the hell was i thinking?
tg is offline   Reply With Quote
Old 05-10-2004, 03:25 PM   #5
violetfemme
Registered User
 
Join Date: May 2004
Posts: 8
Default

Thanks!

So I've got

ActionScript Code:
myData = new LoadVars(); myData.load("data.txt"); myData.onLoad = function(){      county001_mc._visible=myData.county1;      county002_mc._visible=myData.county2; };

But it's not working.

I really am a dunderhead when it comes to LoadVars. How can I tell if my data has loaded?
violetfemme is offline   Reply With Quote
Old 05-10-2004, 03:45 PM   #6
stealthelephant
The Thread Collector
 
Join Date: May 2003
Location: the far side
Posts: 1,409
Send a message via AIM to stealthelephant Send a message via MSN to stealthelephant
Default

all is fine part from the onLoad function, it expects a bool var to be passed
PHP Code:
mydate = new . . . //ur code
myData.onLoad = function(success){
if(
success){
//ur code
}
else
trace("wocca wocca wocca");
}; 
stealthelephant is offline   Reply With Quote
Old 05-10-2004, 04:00 PM   #7
violetfemme
Registered User
 
Join Date: May 2004
Posts: 8
Default

Thanks! Finally... I understand LoadVars! That's letting me know that the data is loaded... it's just nothing is happening with it.

So it's this part that isn't working.

county001_mc._visible=myData.county1;
county002_mc._visible=myData.county2;

Do I need to parse or something? Do a little dance? Say a little prayer?
violetfemme is offline   Reply With Quote
Old 05-10-2004, 04:04 PM   #8
stealthelephant
The Thread Collector
 
Join Date: May 2003
Location: the far side
Posts: 1,409
Send a message via AIM to stealthelephant Send a message via MSN to stealthelephant
Default

use
county1 or
this.county2
no
myData.county1 etc

cos u are inside ur loadvars obj already and u are looking for another obj called myData inside here
stealthelephant is offline   Reply With Quote
Old 05-11-2004, 09:03 AM   #9
violetfemme
Registered User
 
Join Date: May 2004
Posts: 8
Default Still not working

It's still not working. How frustrating!

My text doc reads...

&statement1=true&statement2=false

My actionscript is...

myData = new LoadVars();
myData.load("data.txt");
myData.onLoad = function(success){
if(success){
square._visible=statement1;
circle._visible=statement2;
}
else {
trace("I ain't working, yo");
}
}

I've attached both in a zip file. Any more ideas? I know it has to be something simple I'm overlooking!
Attached Files
File Type: zip visibletest.zip (5.3 KB, 127 views)

Last edited by violetfemme; 05-11-2004 at 09:30 AM. Reason: typo in code...
violetfemme is offline   Reply With Quote
Old 05-11-2004, 09:40 AM   #10
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,106
Default

well, i don't have mx2004, so i can't open you file but this should work, if its finding your file:
Code:
myData = new LoadVars();
myData.load("data.txt");
myData.onLoad = function(success){
if(success){
trace(this.statement1);
trace(this.statement2);
}
}
there may be a path problem to your movieclips... if you've got the wrong path to your movie clips, it won't be able to change the visibility.


another problem, and its the likely culprit, is that your variables are being brought into flash as Strings. so myMC._visible="false" won't do what you want (which is myMC._visible=false). if you change true/false to 1/0, it should work, flash will evalute the string "1" to true, and the string "0" to false.
__________________
tg
---
what the hell was i thinking?
tg is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:00 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.