ActionScript 1/2 :: Unified Rollover Function On Multiple MC's

Nov 4, 2010

I'm trying to code a variable rollover for a sequence of MCs on the stage. I have 3 buttons (MovieClips) on the stage and each time one is rolled over I'm making a different movieclip appear.
 
So I've done this in a root timeline frame script:

//put an empty container movieclip on the stage
containerMC = _root.createEmptyMovieClip("container", this.getNextHighestDepth());
//button 1  - "but1" is my linked instance name and Content 1 is my content movieclip

[Code].....

and so on for each button (1, 2 and 3). As you can imagine if there were 20 buttons there is a lot of uneccessary duplication.
 
What I've considered is, as they are sequential I should be able to read "but"+i and "content"+i and I could push the button names and content names into an array. The thing I'm having trouble with is, how do I write the function so it checks which clip is rolled over and then attaches the corresponding content movieclip?
 
Ultimately I would like the script to check how many buttons there are on the stage and simply iterate for that number (so I don't have to specify how many there are to loop through i.e. numOfButtons = 4),  But not sure how to go about it.

As you can see the code could be the same for each button, if I could read the movieclip rolled over and attach the function variably.
 
In summary what I'm trying to do is have a single function for all rollover buttons named but1 to but n.

View 8 Replies


Similar Posts:


ActionScript 2.0 :: Do A RollOver Detect Without Using The RollOver Function?

Mar 8, 2010

How do I do a onRollOver detect without using the onRollOver function?I have a movieclip and when it's rolled over I have it zooming using the AS2 tween function.In that movieclip there's a form with fields, and if I use the onRollOver function on the movieclip to zoom, the whole movieclip becomes a button thus preventing any input into the form fields. Is there an alternative I can use?

View 6 Replies

ActionScript 3.0 :: Add A Second Function To A Rollover?

Apr 2, 2012

I have 3 buttons on stage, I need to add sounds to each of these as they are rolled over, how do I code them?
 
RD
 
baby_mc.buttonMode = true;
baby_mc.addEventListener(MouseEvent.ROLL_OVER,buttonOver);
function buttonOver(e:MouseEvent):void

[Code].....

View 1 Replies

ActionScript 2.0 :: RollOver Function To Get Name?

Jun 20, 2007

I am currently working on a menu system where all the MCs are created during run time. Well the short of it is that I am having trouble detecting what MC I am supposed to be moused over. I am using a loop, but the loop run and finishes and uses just the last MC reference.

Code:
var menu_xml:XML = new XML();
menu_xml.onLoad = startXML;
menu_xml.load("menu.xml");

[Code]....

View 3 Replies

ActionScript 2.0 :: Movieclip With Rollover And Rollout Function

Apr 28, 2009

for (k=1; k<7; k++) {
this["btn0"+k].onRollOver = function() {
var yBtn:Tween = new Tween(this["btn0"+k], "_y", Strong.easeOut, this._y, this._y-8, 1, true);
}
};
[Code]....

I try to use tweening script for going up and down with a movie clip. But when I export, the button just keep going down and not going up again.

View 1 Replies

ActionScript 2.0 :: Creating A Simple Mc Rollover Function?

Aug 28, 2006

basically i have a mc that i want to use as a button.

frame 1 is the initial state with a stop() action on it. frame 10 is the full rolled over state, also with a stop() action on it, and frame 20 matches frame 1.

so basically i want the button to animate frame 1-10 if they rollover, and animate frame 11-20 when they roll off. i would also like it to detect the current frame, so like if the user rolls off and rolls back on at frame 15, it will play backwards to the mouseover state (frame 10).

View 3 Replies

ActionScript 2.0 :: Button Component And RollOver Function

Oct 20, 2006

Apparently when you give the button component a rollOver function it eliminates the it's own rollOver state... it's as if your rollOver function now overwrite the buttons...

View 1 Replies

Actionscript 3.0 :: Papervision 3d Interactive Cube Rollover Function

Aug 31, 2008

I have successfully implemented the INTERACTIVE 3D Cube, but I can't seem to figure out how to create a rollover function properly, so that once the user rollovers a face, a title for the face fades in and when the user rolls out, the title fades out. I have done it by placing 6 movieclips on the stage and giving each face a rollover and rollover event, but once I rollover a face the title flickers.

View 3 Replies

ActionScript 2.0 :: Rollover Call A Function That Changes Each Movie Clip?

Oct 16, 2005

Suppose I have three different movie clips. mc_A, mc_B, mc_C I want to have a rollover call a function that changes each movie clip. But I don't want to type it out like this:

Code:
mc_A.onRollOver = function() {
Explode.newExplosion(mc_A);
};
mc_B.onRollOver = function() {

[Code]...

Above you will see that I used this, it made sense to me, but this always refers to the main timeline (root in my case). So how do I pass the name of hte clip I am rolling over to a function?

View 8 Replies

ActionScript 2.0 :: Added A Function To Have A Click Sound Play On RollOver?

Jan 24, 2004

should be an easy one, but I tried everything i could think of

I just read this tutorial ::[URL]..Got it to work fine, and even added a function to have a click sound play on rollOver.

The thing is, I can't change the color of the link text on rollOver

View 14 Replies

ActionScript 2.0 :: While Mouse RollOver - Function To Be Exicuted Untill It Is False?

Aug 27, 2004

while the mouse is over my button I want a function to be exicuted untill it is false. how can i do this?

View 2 Replies

ActionScript 2.0 :: Change Tint Of Movie Clip On Rollover Function?

Jun 29, 2006

I'm using a function to make a movie clip with text inside of it act as a button:

Code:
poly.onPress = function() {
clearInterval(intervalID);
_parent.vocab.play();
};

is there a way to add a onRollOver: change tint of 'poly' to red (poly is a mc)??

View 14 Replies

Actionscript 3 :: Function - Disabling Button Rollover For Certain Number Of Frames Flash

Jan 24, 2012

I'm constructing an area with selectable buttons that transition and appear every 10 frames. During these 10 frame transition periods I don't want the buttons to be selectable and if possible to disable the rollover.

I've tried creating an If statement on the addEventListener so that it only works when currentFrame is 11,21,31 etc but this didn't work. I then also tried the same principal on the function to which the Event Listener relates but still no success.

View 2 Replies

ActionScript 2.0 :: Write A Global Function For Button RollOver, RollOut Animation?

Aug 25, 2004

Im trying to write a global fucntion for button rollOver, rollOut animation.

here's what I have as of right now.

On the root timeline::

stop();
function buttonFade(fade) {
if (fade) {

[Code]....

Im still wishy washy on function syntax..

View 11 Replies

ActionScript 3.0 :: Timer Event Rollover Repeating - Rollover Action Would Go After The Set Amount Of Time

Feb 18, 2010

The script for my timer worked for one button but as soon as I set up the other 2 buttons to do the same, I started having a problem where the rollover action would go after the set amount of time was up but then would repeat itself once after the set amount of time was up again. just to clarify, if it needs it, the reason I don't have a rollout attached to these buttons is because I want the menu to stay out until you leave the menu area

so I have an invisible button called menuin_btn which sits to the right of the menu and covers the rest of the stage where the content will be, so you have to rollover that area for the menu to roll back in. The "rollin" in my code brings the movie clip to frame 16 (the end) where I have a gotoAndStop(1); command to get it back to frame 1 so the rollover can be used again. I've attached a zip with my current flash file and swf and here is what my current script looks like on the main scene:
 
[Code]...

View 3 Replies

ActionScript 2.0 :: Making A Ball Move - When Rollover Twice Quickly, It Also Accepts The Second Rollover Command?

Jan 22, 2005

I am making a ball move from left to right and back. but when I rollover twice quickly, it also accepts the second rollover command. I would like it to accept that second rollover only when the first one is finished. I mean, I want the first to be finished before it accepts another rollover.I know it is simple to solve this with a tween using frames instead of as, but I was wondering if someone knows how to adapt the script.

on(rollOver){
ballTween = new mx.transitions.Tween(balMC, "_x", mx.transitions.easing.Regular.easeOut,balMC._x, 44, .5, true);
ballTween.onMotionFinished = function() {
ballTweenterug = new mx.transitions.Tween(balMC, "_x", mx.transitions.easing.Regular.easeOut, 44,11.9, .5, true);

View 2 Replies

IDE :: RollOver Command Error Mouse Events Are Permitted Only For Button Instances On (rollOver)

Jul 26, 2009

I'm using actionscript 1.0 and 2.0 on flash Pro 8 and keep getting an error when I test the movie. Here is the error:

[Code]...

I've tried to create this rollover navigation...starting over 6 times already. Is there different language / coding for 1.0 and 2.0? I don't understand what I'm doing wrong.

View 1 Replies

ActionScript 2.0 :: Show Rollover Msg Or Tooltip When Rollover On Hyperlink In Flash

Jan 28, 2010

i wnat to show the message "Hi how are u" as a rollover message or a tooltip when i rollover the hyperlink Know More

View 1 Replies

ActionScript 2.0 :: Activate A RollOver-function When The Mouse Rolls Over A Movieclip Inside Of A Movieclip?

Apr 17, 2010

I am trying to activate a rollOver-function when the mouse rolls over a movieclip inside of a movieclip.On the main window (root), first you rollOver a button where a window shows up with more options (movieclips).From stage, my first movieclip is called "catapultas_read_more" which leads to amother movieclip called "pic1_mc". The label that is going to play when mouse over on pic1_mc is "rollOn".I tried this.gotoAndPlay("rollOn); directly inserted to the movieclip, but the movieclip inside pic1_mc never starts

View 8 Replies

ActionScript 2.0 :: Rollover/Rollout Stops Working After The First Rollover?

Nov 13, 2009

I'm trying to create a rollover for a movie clip. On rollover, a line underlines the text,and when it rolls out, the underline reverses. This works fine the first time. The next time you rollover, the animation doesn't work. Then when you move the mouse off the button, a line appears under the text and doesn't go away. Here's my code on the invisible button.

on(rollOver){
this.gotoAndPlay("animIn");
}

[code].....

View 6 Replies

ActionScript 2.0 :: Animation/rollover Stops When Rollover Another Button?

Jul 28, 2004

The animation/rollover works well but it still abruptly stops when I rollover another button. The link below is an example on what I want to accomplish.

View 1 Replies

ActionScript 3.0 :: Rollover Image Flashes On Rollover

Jul 15, 2009

I have a button set up, that when you rollover the button, it changes into another picture and stops, and also when it's rolled over, a large picture appears under the rollover.But when I first rollover the button, it acts like it's told to go to the out state. When I rollover it again it works fine.URl...there is my code to go into the movieclip and play the button

View 1 Replies

ActionScript 2.0 :: Using A Function Over Multiple Mc's?

Sep 19, 2009

I have created a file that displays Home and Away team names by using an mc that has 2 dynamic text fields "home" and "away". This mc is copied and pasted below the one above and each of these mc's has the following action:

ActionScript Code:
onClipEvent (load) {
gameNo=0;

[Code]....

I can't get this to return the required values.

View 7 Replies

IDE :: One Function, Multiple Buttons

Nov 16, 2008

I have three buttons. My goal is that each button will load and play a sound file from the internet. Here is what I have:

function loadPlaySnd(pSpecifier1:String):void {

arguments;

SoundMixer.stopAll();[code]....

Every Button I press goes to the same sound file. The best I can figure, is that the file I loaded the first time I pressed a button has been uploaded, and from there I cannot load another file over that variable when I try another button.

View 2 Replies

IDE :: Control Multiple MCs With Function?

Nov 26, 2009

I have a keyboard which consists of 26 MCs, named keya, keyb, keyc.... and so on.

I want to create a button that will disable all these buttons at once, but I'm not sure how to express it in actionscript. Basically, I need it to say 'on release, key X (where x = all characters from a to z) _enabled= false;

View 3 Replies

ActionScript 2.0 :: Same Function On Multiple Objects?

Apr 28, 2009

I am building a scrolling image bar, so I've created code that works perfect on one object. However, I need this code to apply to multiple objects at once so that they will move left and right and resize independently from each other (to give this sort of 3d revolving look). Other boxes will be to left and right of the current black box. Code is below as well as link.

Code:
function mousetracker(object){
boxstartx=object._x;
boxstartwidth=object._width;

[code]....

View 1 Replies

ActionScript 3.0 :: Use A Function In Multiple Scenes?

Feb 27, 2009

I have a .fla project being created under CS4, using ActionScript 3.0, that consists of multiple scenes.

In the code attached to the first scene, I define some functions that are used as methods on buttons[code]...

View 1 Replies

ActionScript 3.0 :: Multiple Buttons With Same Function

Jul 24, 2009

I have a group of 50 buttons (named Bottle01 > Bottle50) that I want to have the same code on. The code I want is to, when pressed, put the buttons individual name into a variable and then move to a point later in the timeline. I have just started using as3 as I need this to work through Air and have been googling all afternoo and have cobbled something together, but it doesn't seem to work that well. This is the code I have sofar which is probably very wrong:

[Code]...

View 2 Replies

ActionScript 3.0 :: One Function For Multiple Keys?

Dec 21, 2009

I'm building a menu for a website that plays a sound each time you mouse over one of the buttons. (each button is a piano key) I've written two functions that change the size of each key on ROLL_OVER and ROLL_OUT events. What I want is someway to play a unique sound in my library for each key, without writing a separate function for each key. Either a new function, or just written into my existing ROLL_OVER function. Currently, it plays the same sound for every key.

Here is a zip of my project

[URL]

What I've got in there is a fla file called menu.fla In that file there is a movieclip on stage called "keyboardmenu" and inside that movieclip are 8 movieclip's (my buttons) each with a unique instance name. In the library there are 8 mp3 files with class name keysound1, keysound2 etc...Here is my code: ( I'm using tweener to handle the scaling. )

Code:
import caurina.transitions.Tweener;
function keyisdown(e:MouseEvent):void{
Tweener.addTween(e.currentTarget,{height:185, width:80, time:.25, transition:"easeOutBounce"});
varsound1.play();

[code]....

View 3 Replies

ActionScript 2.0 :: Multiple Intervals For One Function?

Jan 18, 2011

I've got one function that I'm running, but I need it to run at different times for different movie clips.Here's my code. What is wrong with this?

ActionScript Code:
function tweenText(_TEXT:MovieClip, _START:Number, _END:Number, _SEC:Number, _INTERVAL:Number) {
var xTween:Tween = new Tween(_TEXT, "_x", Strong.easeOut, _START, _END, _SEC, true);
clearInterval(_INTERVAL);

[code]....

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved