Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Action Scripting (or trying to)

Status
Not open for further replies.

dzr

Programmer
Nov 20, 2001
109
US
(beginner here with no luck finding help by searching forum/google)

I have a variable that is now a global variable set in my movie but will eventually be a variable passed via PHP to the flash movie (one step at a time...)

I have 2 movie clips and I want only one visible depending on the variable passed in.

global:
roomnumber=100;

(i have no idea if it's set right - it's under "actions for frame 1)



this is the actions i have on each movieclip:

setProperty("movieclipname", _visible, "0");
if (roomnumber="117") {
setProberty("movieclipname", _visible, "1");
}

setProperty("movieclipname", _visible, "0");
if (roomnumber="100") {
setProberty("movieclipname", _visible, "1");
}


->both show up as visible. even if i take the conditional out and just do set _visible =0 it still shows up.
 
What you want is :

Code:
var roomnumber = 100
_root.movieclipname._alpha = 0;
if (roomnumber == "117") {
  _root.movieclipname._alpha = 100;
}

root.movieclipname._alpha = 0;
if (roomnumber == "100") {
  _root.movieclipname._alpha = 100;
}
Regards

Big Dave

davidbyng@hotmail.com


** If I am wrong I am sorry, but i'm only trying to help!! **

 
is the global variable supposed to be in the
"actions for frame 1"
(there's only one frame for the movie)

i'm very new at this so sorry for sounding like a 'flash-reject'
 
david fixed it but didn't say what you did wrong.

to set a variable to a certain value you use =.
to test for equality you use ==.

so basically you where setting roomnumber in you're if statements which made them true.

so it should be something like this...

_root.movieClipName._visible = false;
if (roomnumber == 117) {
_root.movieClipName._visible = true;
}
_root.movieClipName._visible = false;
if (roomnumber == 100) {
_root.movieClipName._visible = true;
}


using visible instead of alpha means the movieclip will not be using up cpu when its not visable.
 
uh...i knew that! now i'm in the "programming-reject" category.

i'm so lost i don't even have any intelligent questions left.

thanks for the help anywayB-(
 
how can you be lost..explinations don't get any better than that!.and you almost had it in the begining..
logo.gif


carlsatterwhite@orlandomediasolutions.com
 
oh you would be amazed at my ability to get confused. i think most of it has to do with my lack of Flash skills. no matter what i try i can't set the movie clip visibility to false.

here's my process:


1st import the wmf file of the floorplan. name it.
create new layer - name it "clips"
in clips import a pic of a star (wmf format) to show up in the room that was chosen
press f8 - make movie clip named "rm100"
import again, f8, movie clip named "rm117"
create new layer - name it "control"
in control make a little circle and move it out of screen view in scene
press f8 - make it a movie clip named "control"
go into movie explorer and assign actions:

//set them all to invisible
onClipEvent (load) {
_root.rm100._visible = false;
_root.rm117._visible = false;
}


test movie and those stars show up anyway

 
are you naming the instances of the movie clips in the instance panel or just naming the mc it self?.when you target the mc you have to make sure you click on the mc on the stage, goto the instance panel (window>panels>instance>)and name it there!.have you done that?.
logo.gif


carlsatterwhite@orlandomediasolutions.com
 
that got it! thanks so much!!

i'm really not as stupid as i sound.
 
hehe i wasn't trying to make you sound dumb :(
i just wanted to explain incase you didn't know thats why it wasn't doin what you planned it to do.
 
no offense taken. i have started this project with no background in flash at all. i'm really just trying to avoid all the other coding i'm supposed to be doing. flash is fun.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top