View Full Version : Flash 8 ActionScript 2
MikeN82ndABN
08-08-2007, 03:15 AM
My company has charged me with creating a web page. I created a Flash menu bar but can't seem to get anything to work, I have went to several web pages and followed instructions step by step and still can't get anywhere. I have limited knowledge on Flash, but vast knowledge on what it can do. Attached is the file, and images of what I would like for it to do. Any information on this would be greatly appreciated.
Pictures should be self explanatory but if not, Menu Bar 1 is what it looks at idle, Menu Bar 2 is what it looks like when Catalog is pressed, and Menu Bar 3 is what it looks like when Catalog > Doors is pressed. Basically a drop down menu within a drop down menu.
Greatly appreciate any and all help,
Mike
MikeN82ndABN
08-08-2007, 04:06 PM
Ok so currently I looked over one of Atomic's scripts he has for his menu button with a little bit of tweaking. Now my issue is that instead of it only activating during a mouseon "catalog" event, anytime I roll my mouse over the entire Menu bar the catalog button activates and starts the process of the rolling sequences + the doors menu under catalog. Here is the current ActionScript commands:
// check to see if the mouse is over the Catalog every time a new frame is entered
// (at the current frame rate that is 12 times a second)
onClipEvent (enterFrame) {
// if the mouse IS over the Catalog ...
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
// if the Catalog is NOT fully open
if (this._currentframe<this._totalframes) {
// go to the next frame of the Catalog opening sequence
nextFrame();
}
// if the mouse is NOT over the Catalog
} else {
// if the Catalog is NOT fully closed
if (this._currentframe>1) {
// play the previous frame of the Catalog opening sequence
prevFrame();
}
}
}
Also upon testing this file I get:
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 3: Statement must appear within on handler
gotoAndPlay(frame);
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 4: Statement must appear within on handler
{
Total ActionScript Errors: 2 Reported Errors: 2
But when I run a script error check nothing comes up.
Again any help with this would be greatly appreciated.
Mike
MikeN82ndABN
08-08-2007, 05:38 PM
Scratch help need, fixed the file, and got it to do exactly what I wanted it to do. Thanks anyways.
MikeN82ndABN
08-09-2007, 07:07 PM
I have an issue with this DD Menu.
One is that I would like to be able to click the catalog button instead of mousing over for the DD Menu to start, and then Clicking on Doors button to activate the second piece instead of mousing over it.
Second is once I export it to an SWF and Import it to Dreamweaver, the menu does not work.
Any help on this would be greatly appreciated
evride
08-09-2007, 07:44 PM
i dont work with Dreamweaver much, in fact i never do, but i think you are testing it wrong. so to check, how do you test it? in the mean time i'll look at your file
update: haha - its obvious you don't know flash
edit:nevermind about the dreamweaver question. i think i know what you mean about it not working in dreamweaver. i haven't tested it, i just remembered a problem other people were having. you probably set the height and width to what the main menu is. but the other menu buttons are off stage. what you need to do is put the flash movie on top of all other divs. i dont remember the solution but just search the forum for flash on top.
now about the flash. you need to learn how to use listeners. you dont need to use hitTest. thats overdoing it without getting good results. you need to convert all the buttons to movieclips
select the images and text for the button and right click on it. select Convert to symbol and choose movieclip. give it a nice name.
now you need to give the buttons on the stage an instance name. an instance name is what flash uses to edit properties of the movieclip and add listeners.
once you have instance names adding actions to them is very easy.
mc_instance_name.onPress = function(){
this.gotoAndPlay("2");
}
this code will go on the main timeline. NOT on the movieclip. thats why you need instance names. deselect all movie clips and then in the actions panel copy and paste the code. in the actions panel, if you haven't already, make sure to turn off script assist. it will just screw up your life.
you can add several listeners to the movieclip.
theres
onPress
onRollOver
onRollOut
onRelease
onDragOut
onDragOver
so if you had an mc name of catalog and you wanted catalog to play inside the movieclip once it is released by the mouse this is what you'd use
catalog.onRelease = function(){
this.play();
}
inside the movieclip you can tell it at what points to stop at by adding as stop function
so click on a frame of your choice. deselect all movieclips and images. open up the actions panel and add this code.
stop();
also, if you have a movieclip inside another movieclip and the top movieclip has a listener on it, you cannot add a listener to the nested movieclip since the parent movieclips listener will override it.
MikeN82ndABN
08-09-2007, 08:17 PM
Testing it in Firefox, there is an HTML test button, much like the movie run test in flash. Well I figured out my issue inside Dreamweaver, but it is a little much considering that the menu (which is all the space I am limited to) is at a height of 30px and the actual movie was done at 280px, and for it to show up in Dreamweaver, the Frame has to be set to 280px in order to show the full movie menu bar, which takes up space that I can put images/product viewing into. Is there a way to export the menu only and have the movie files overlap the actual HTML like a majority of sites I have seen?
evride
08-09-2007, 08:30 PM
i just wanted to let you know i edited my last post. i do that a lot and you answered back before i was done editing it.
MikeN82ndABN
08-09-2007, 08:37 PM
What do you mean by "Instance Names?"
Update: Found out what you meant by Instance Names, so that part is done.
atomic
08-09-2007, 09:19 PM
...also, if you have a movieclip inside another movieclip and the top movieclip has a listener on it, you cannot add a listener to the nested movieclip since the parent movieclips listener will override it.
So what's going to happen when he tries to open the doors sub-menu?
MikeN82ndABN
08-09-2007, 09:39 PM
Sorry dude, I have tried countless ways of what you were saying, and it didn't work, however using Atomics Script works under both movies, and works quit well, except the fact that it runs during a mouse over instead of a mouse click. I guess the Mouse over will have to do. Something is better than nothing. Thanks anyways homie...
atomic
08-09-2007, 10:55 PM
Why is it that you absolutely want it to be a mouse click, rather than a mouseover, since most menus I see use the mouseover?
MikeN82ndABN
08-10-2007, 04:05 AM
Well mainly due to me absolutely hating the fact that when I try to keep a menu open and the mouse wonders else where I have to go back and remouseover the button. This website will be for out in the field contractors who are up shits creek without a paddle, and trying to make the website as user friendly as possible.
atomic
08-10-2007, 04:16 AM
How about this one then...
http://www.actionscript.org/resources/articles/23/1/Drop-down-menu/Page1.html
MikeN82ndABN
08-10-2007, 07:38 PM
Atomic Thanks for the link, this is what I have now, works wonderfully. Didn't even see that tutorial.
Mucho Gracias and bravo for the help.
atomic
08-10-2007, 10:21 PM
;)
evride
08-11-2007, 03:19 AM
instance names are what you give movieclips so that the actionscript can reference them. otherwise flash would know what movieclip to give the action to.
@Atomic
what he had was jsut bad. he had no movieclips just images. also he used hitTests on stuff cuase he didnt know how to use the onPress. also he had movieclips inside movieclips so he couldn't add a listener to the other clips.
atomic
08-11-2007, 04:21 AM
Well guess this Mathemagician solved it all... Take a bow! :rolleyes:
evride
08-11-2007, 02:36 PM
What do you mean by "Instance Names?"
Update: Found out what you meant by Instance Names, so that part is done.
So what's going to happen when he tries to open the doors sub-menu?
:p haha, ok i was trying to answer this dude's question and your question about what was wrong with fla and hadn't looked at this thread in awhile.
edit: oops, i hadn't seen his update. haha, so my reply wasn't needed at all i guess. sorry. throws himself upon a sword Japanese style :o. JK im too handsome to die.
Update: Found out what you meant by Instance Names, so that part is done.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.