PDA

View Full Version : MC Prob



Lord Rahl
November 14th, 2004, 06:14 PM
Ok, Here is the problem. I have a MC with two frames in it.
Frame 1: This frame has nothing in it. Just blank with a stop(); action.
Frame 2: This frame contains a small picture with a button.
Then I put the following actions in the MC.
onClipEvent (enterFrame) {
if (Key.isDown(65)) {
gotoAndStop(2);
} else {
gotoAndStop(1);
}
}
Then I created another Scene called PICS. When the key A (65) is down it does go to the second frame, only problem is then the button doesn't work. I have the button with all its designs needed and the following script.
on(release){
gotoAndStop("PICS",1);
}
(Oh by the way, Both scenes have a stop action on frame 1 in its own actions layer.) The button works... somewhat. The actions don't seem to be taking effect. When I clicked the button the whole button disappears real quick and reappears... Odd eh. So I can't get the to work. Any Ideas???
One last question as well. Is there anyway to flip a MC over when you hit a key. For example: Say I have a arrow pointing to the right and I hit the left key. I wan't it to flip over and stay like that untill I hit Right Which then flips it to the other side and so on. (At the same time as the MC is playing.) Sorry if this is too confusing. I'll try to explain it better if needed.
I have attached a fla file showing the prob. Kinda late so I hope I got the right one. lol THANKS

Dr Warm
November 14th, 2004, 08:31 PM
i haven't done your first question yet, but as for the second (about flipping) u use _xscale, put this in the main timeline:

//initial variable
flipped = false;
_root.onEnterFrame = function(){
if(Key.isDown(Key.LEFT) && !flipped){
_root.someMC._xscale *= -1;
flipped = true;
}
if(Key.isDown(Key.RIGHT) && flipped){
_root.someMC._xscale *= -1;
flipped = false;
}
}
that should work.
i'll look at your fla a little l8r

Dr Warm
November 14th, 2004, 10:10 PM
as for your fla, i looked at it,
The actions don't seem to be taking effect. When I clicked the button the whole button disappears real quick and reappears... Odd eh. So I can't get the to work. Any Ideas??? this is because wheneva you're taking A button off it goes back to frame one, i fixed this.

Also you're button actions are working (you can tell because trace("pressed") is called) but i'm not sure why it's not going to the next scene. my suggestion DON'T USE SCENES!! just use frame number 100 if you have to even!

Hope that helps

Lord Rahl
November 15th, 2004, 07:52 PM
Great. Thanks for the tip. Ill repost if anymore probs come up.