TeamPhotoshop
Reviews, updates and in depth guides to your favourite mobile games - AppGamer.com
Forum Home Latest Posts Search Help Subscribe

my actionscript that doesn work

Page: 1 Reply
Feb 9th 2003#89570 Report
Member since: Dec 24th 2001
Posts: 222
boxColor = new Color(_root.box);
if(Math.random()>=.5) {
boxColor.setRGB(Ox006699);
}else{
boxColor.setRGB(Ox000000);
}
that actionscript is supposed to make a little box i have change between black and a shade of blue green at random but it doesnt work....it should be targeting _root.box because thats the movie clip.....i cant find any obvious error.....so please help me out......

this part of the post has been placed here a couple hours after the original: ive been trying to fix the problem and to narrow down variables i just made a square on the main stage converted it into amovie clip and gave it an instance name of box_fill
then on the main timeline i added a frame and put hte following actionscript
myColor2 = new Color(_root.box_fill);
myColor2.setRGB(Ox000000);
and guess what.....the color of the square didnt turn black....i have a good feeling this is where the problem lies so if you could tell me wha ti might be f'ing up i would appreciate it
Reply with Quote Reply
Feb 9th 2003#89612 Report
Member since: Jan 24th 2003
Posts: 10
riveroaks: did u make "box_fill" the name of the movieclip in the library or is it the variable name in the instance panel?
Reply with Quote Reply
Feb 9th 2003#89620 Report
Member since: Dec 24th 2001
Posts: 222
its the name of the instance...i have forgotten to do that before so i made sure to name the instances this time and double checked all of it.....the syntax checks out in normal mode.....the logic makes sense to me....so i dont understand where teh hold up is....
Reply with Quote Reply
Feb 9th 2003#89626 Report
Member since: Jan 24th 2003
Posts: 10
is ur actionscript in the first frame of the timeline? and how many frames are thee in the timeline?
Reply with Quote Reply
Feb 9th 2003#89664 Report
Member since: Dec 24th 2001
Posts: 222
well for the movie clip that i talk about in the first part there is a button looking thing which is a movie clip and then inside the button the fill of the button is a movie clip and inside that fill movie clip the fill is again a movie clip.....
layer 1 > whole button > fill(the one with actions on it)> fill movie clip.....the fill makes up two movie clips by itself....but each one has a different instance name.....
but then i went and made a square on the main timeline to just test out the setRGB command with the new Color(); object so there is a square on teh main timline that is a movie clip and on the main timeline there are two frames one with the actions stated in the original post and one blank so that the check happens constantly....but then i took out the random part and just tried to set teh color to one other then the color i made the mc.....
myColor2 = new Color(box_fill);
myColor2.setRGB(Ox123456);
thats not the actual color i assigned but in any case teh square just appears black....it should either be white(the color i made the box) or blue(the color i assigned in the code) but its black
Reply with Quote Reply
Feb 9th 2003#89684 Report
Member since: Dec 24th 2001
Posts: 222
nm everybody i got it......in the setRGB(Ox000000) area i put an o in caps instead of a 0 because i couldnt tell it was a zero in the macromedia reference...but now i have a different question i now have the blinker working but i cant reproduce it....i have a blue sqaure that is a movie clip and inside it i have two frames on two layers....the action layer and the fill layer....the actions are as follows:
myColor = new Color(this);
if(math.random()>=.5) {
myColor.setRGB(0x00ff00);
}else{
myColor.setRGB(0x000000);
}
if i reproduce that mc it doesnt blink....i think its because in each additional movie clip it creates a new color object but it has the same name...im not sure....but can anyone tell me how to reproduce the blinker so every mc of it blinks?
Reply with Quote Reply
Page: 1 Back to top
Please login or register above to post in this forum