PDA

View Full Version : Actionscript Nightmare


dangillow
03-29-2005, 06:05 PM
Hi,

I am having terrbile problems with actionscript and I'm wondering if any of you would be able to give me a few pointers. I am creating a Flash prototype for a University Assignment.

My Flash prototype is a TV and a remote. My "TV Interface" is a movie clip and is on the main scene. My remote control is also a movie clip on the main scene and the up and down buttons are buttons.

My problem is I am trying to get the up and down buttons on my remote to go up and down on the tv interface. Except there not working. I am using this action script for my up button and it works.

on (release) {
_root.interface.gotoAndStop("chan1");
}

Except when I try and add the same actionscript for next channel it doesnt work. I am going insane trying to get this to work. If anyone could help me I would be so greatful. It's been pretty tricky explaining the problem and I hope I have explained it enough. I have also put the flash file on my website so you can download it to have a look.

http://www.gilletto.kicks-ass.net/downloads/prototype.zip

Many Thanks

Dan Gillow

mechwarrior
03-29-2005, 06:46 PM
I took a look at your program, but I'm not understanding your question. Did you mean that repeated clicks on the + button do not cycle up through the channels? Just wondering what specific action does not work.

dangillow
03-29-2005, 06:51 PM
Yes thats exactly what I mean. I cant get the + and - buttons to cycle through the interface.

Many Thanks

Dan

Barn
03-29-2005, 06:53 PM
Most of us have our own stuff to do, to, and do not have time to download your zip file and analyze the entire movie to see what's amiss.

Copy and paste the button code that is not working from the actionscript panel into another reply.

dangillow
03-29-2005, 07:00 PM
This is the code I am using inside my buttons

on (release) {
_root.interface.gotoAndStop("chan1");
}

This code works for the first button, but when I add the same code for the next state for the button it doesnt work. Thank you for all your responce so far.

Dan

Barn
03-29-2005, 07:01 PM
Show the code you are using that's NOT working.

dangillow
03-29-2005, 07:04 PM
Up Button

Frame 1

on (release) {
_root.interface.gotoAndStop("chan1");
}

Frame 2

on (release) {
_root.interface.gotoAndStop("chan2");
}

Frame 3

on (release) {
_root.interface.gotoAndStop("chan3");
}

Frame 4

on (release) {
_root.interface.gotoAndStop("chan4");
}

This is the code thats not working.

Dan

Barn
03-29-2005, 07:12 PM
I don't think I'd recommend placing a new button and redefining the button event on every frame, but if the interface movieclip exists at every point where one of those button event actions occurs, and those frame label names actually do exist in the interface movieclip, and the interface movieclip is not already on the destination frame label, all those should work.

mechwarrior
03-29-2005, 07:15 PM
I don't think that frame method is the way to go. You could just have one frame with the buttons on it. For the button code you could have something like this:

on (release) {
_root.interface.gotoAndStop("chan" + channelNumber);
channelNumber++;
}


You would need to put a variable in the Remote mc like this:
var channelNumber:Number = 1;


You code the same release code on the down button except use channelNumber-- (check to see if less than one first).

I tried it and it worked in your code.

Your mutiframe method has different button instances, one in each frame, with code on some and not on others. Can get confusing.

Hope this helps.

dangillow
03-29-2005, 07:20 PM
Thank you mechwarrior that worked. Although my knowledge of Flash and actionscrip is quite basic as its my first time using Flash. Where abouts do I insert the variable

var channelNumber:Number = 1;

Thanx

Dan

usa_hodson
03-29-2005, 07:27 PM
I changed the code on the button to a case statement for you and now it shifts through fine - you can download the file from www.getwithit.info/Flash

I hope this helps you out. Also - practice 'save & compact' when posting files...

All the best,

James

PS: variable v_channel is initiated on click of blue button on remote...

mechwarrior
03-29-2005, 07:29 PM
You could put it on frame1 of the Remote movie clip. Just under the stop;

That should work.

dangillow
03-29-2005, 07:33 PM
Hi,

usa_hodson I was unable to open the file. I am using Flash MX maybe you saved it in a higher verison of flash?

Regards

Dan

usa_hodson
03-29-2005, 07:41 PM
Yes I did, sorry - I've just remedied that so you should be able to download it in about 1 minute...

James.