ActionScript 3.0 :: Reusing Functions On More Than One Movie Clip?
Apr 2, 2009
I'm doing a filmstrip animation and each frame of the strip has a small pic on it and using TweenLite, I'm making it expand and contract on mouse rollover and rollout. That's not the problem. Since it's basically the same function, I don't want to have to write it for all 16 frames. I thought I'd try 'this' but that doesn't work on AS3. So I'm trying to find a solution that does. Here's my code (for one frame of the movie....in this case, the eighth).:
import gs.TweenLite;
fsAnim.filmstrip_mc.photo8_mc.addEventListener(Mou seEvent.MOUSE_OVER, photoOver);
fsAnim.filmstrip_mc.photo8_mc.addEventListener(Mou seEvent.MOUSE_OUT, photoOut);
function photoOver(evt:MouseEvent):void {
[Code].....
View 3 Replies
Similar Posts:
May 23, 2010
If I use an empty movie clip to load a series of images into,how do I get them to load in the center?The images are all different sizes.I think this is fine, if they loaded with the center of both the target clip and the image aligning.Upper left registration point for the target is not good.
View 10 Replies
Feb 4, 2010
I am trying to reuse the lines of code and it worked fine the first time but when I tried to use the evtObj.target.name it gave me error 1120:Access undefined property evtObj.Here is the code I tried to use:When I test the movies it just runs automatically instaed of waiting for the click.
View 4 Replies
Sep 11, 2009
I somehow am able to write bits of code but am still learning how to restructure code so that it is more efficient.I have 15 buttons. Each one, when rolled over, should change the color of 2 movieclips underneath it (and when rolled out, should change back). I have the below code so far but I don't think I have to re-write the functions each time. How do I "re-use" the function code (or, only write the function code once), but specify what movieclips the function should be applied to? These are just 2 of the buttons of the 15:
Code:
menu_mc.invis1.addEventListener(MouseEvent.MOUSE_OVER, changeColor);
menu_mc.invis1.addEventListener(MouseEvent.MOUSE_OUT, changeBack);
function changeColor(event:MouseEvent):void[code].................
View 9 Replies
Jan 21, 2010
How can I trace all available Movie Clip variables and functions?
View 5 Replies
May 31, 2011
I want different instances of the same movie clip to have different functions.
First movie clip:
Code:
myMovieClip.onRelease=function(){gotoAndPlay(16);}
That works!
But:
Code:
secondInstanceOfmyMovieClip_mc.onRelease=function(){gotoAndPlay(30);}
doesn't become a clickable movie clip.
Yes, I have given it the appropriate instance name. The above is the only code I have added so do I need something else to get the second bit to work?
View 4 Replies
May 26, 2010
How do I move / create a button that functions inside a movie clip?I have been creating a quasi-simple website following the tutorial provided by Lynda.com. Using I have created a functional site in which the buttons work so long as they are part of the main timeline. However if I take this functional button and drop it into a movie clip I've created, it ceases to function. Drag it back out of the movie clip and it starts working again. I am sure it's an action script coding problem on my end.[code]
View 2 Replies
Feb 22, 2012
I have a document class that assigns some button on the stage an function.
I have 2 cards on the stage. They have their own class.
From the buttons script i can trace the cards and i get: [object MovieClip]
But I cannot call a function in them like card_0.flipUp();
it errors:
TypeError: Error #1006: dimMe is not a function.
the card class is public starts out like:
public class FlipCard extends MovieClip {
The function is public:
public function dimMe ():void {
this.alpha = .1;
}
View 1 Replies
Aug 11, 2009
I have my function on frame 1
Code:
function backhome(event:MouseEvent):void
{
this.gotoAndPlay("mapbegin");
}
At frame 10, I have a movie clip that animates and stops. Inside of that movie clip is a button that I want to go back to frame 2 when someone clicks on it. I want to be able to click on that button and call the function above.
panamacitybeach.returntomap1.addEventListener(Mous eEvent.CLICK, backhome);
When I put that code on the movie clip keyframe on the root timeline, I get this error.
TypeError: Error #1009: Cannot access a property or method of a null object reference. at intmap_fla::MainTimeline/frame1()
The addEventListener is laying on the keyframe in which the movie clip is. Why can't I call that function later on where the movie clip shows up?
View 2 Replies
Aug 21, 2010
I'm having problems with the scope of nested functions. I have a movie clip: "MC_clip" inside that movie clip there is a button: "inside_button". when users press "inside_button", I want the movie will jump to play frame 5 (main time line). how do i refer the stage from inside a movie clip?? another question is about the other way: how can I call to a function that is declared inside a movie clip?? is that movie clip have to be an instance on the stage??
View 8 Replies
Aug 2, 2009
I've loaded an external .swf into a movieclip in my parent .swf using the loadMovie(); function. The file loads perfectly and in the right position, however I can no longer access the functions of the external .swf. When I load the file into a level rather than a movieclip, the functions (buttons and timeline) of the external .swf work properly. Is there any way to use the functions of the external .swf when I load it into an empty movie clip?
View 7 Replies
Aug 11, 2009
I have my function on frame 1
[Code]....
At frame 10, I have a movie clip that animates and stops. Inside of that movie clip is a button that I want to go back to frame 2 when someone clicks on it. I want to be able to click on that button and call the function above.
[Code]....
View 0 Replies
Jul 8, 2010
Suppose you have a slideshow movie that loads content such as images or Flash movies itself and continually replaces content with new images or movies as a viewer browses through content. Is there a way to store images or movies that have been loaded so that if the same content is selected they do not have to downloaded again? Presumably once content has been unloaded or something has ben loaded into the same level the data is wiped from memory and has to be downloaded if it is displayed again. How could content be stored in Flash or does the content stored in the browser cache take care of this?
View 1 Replies
Feb 17, 2010
I have to build one MXP package for Flash (not Flex). But i have multiple components, somthing like HelpSymbolMovieClips(have its on class), one image holder. etc. I need to combine there swc file into a single MXP file.How can i make a all these multi movieClip functionality in a single SWC file. Am bit confused about the structure of the component which is having multiple functions/MoiveClips. like (Image gallery components.
View 1 Replies
May 9, 2010
Im able to link to a movieclip inside a movieclipUnfortunately one of the movieclips now are a scrollbar and scroll. Now the actionscript isnt working?cal.onPress = function() {gotoAndPlay(2);message1.contentMain.message.total = unit1;
View 17 Replies
Jun 24, 2010
I am pretty new to ActionScript 3 and Flash. I don't want my movie clip to play unless the person's mouse curser is on the movie clip for more than a second. If the person just runs their curser over the movie clips really quickly, then it should do nothing. It must be more than a second. How do I code that?
[Code]...
View 17 Replies
Jan 11, 2010
I'm creating a small drag & drop activity, and I want to be able to check and see if the dragged movie clip is completely within the bounds of another movie clip (or at least in the bounds of a certain x/y zone on the main stage. I can't use dropTest because it returns true if any tiny bit of the movie clip overlaps with the dropTest movie clip.
I also thought of something that just checks the x/y coordinates of the dragged movie clip, but I'd need this to reflect a range of values rather than one coordinate. For instance, I'd want to return true if the movie clip's x is between 50-60 AND the y is between 50-60. I'm attaching a small graphic to illustrate in case my explanation isn't clear enough [URL]
View 3 Replies
Feb 21, 2010
I have created a flash website, each button is a movie clip with an invisible button over it containing the following script
on (rollOver) {
_root.mouse_over_profile_btn = true;
}
on (rollOut) {
[Code]....
each page is also a movie clip and on release of a button its played. the problem is that when i press another button to play another movie clip 'page' the old content is still there.
Is there a way of reversing the page transition i have used to bring out the movie clip and then bring in the next movie clip.
View 0 Replies
Jun 22, 2005
i am making a pacman game, and i need to know how to make it go to a certain scence when a movie clip collides with another movie clip.
View 2 Replies
Nov 5, 2010
There is a bad gap in my knowledge with Event Dispatch and Event architecture, and this problem proves it. I've been getting nowhere on this problem for two days, I've posted everything to my Flash site. Go here, please: [URL] Click on "Flash Banners" The two thumbnails represent two different classes. Each class is identical. Both are "extends Movie Clip" classes. Tweeners of various types control the hover and click methods. URL Loaders load the thumnails which I then wrap in MC's and make them buttonMode = true, etc. Hover and click to load the Banners on the thumbnails.
I can't send an event from the Eagle movie clip or the T2D movie clip to tell the other to fade out. Both Banner classes are instantiated through a separate Base class. I'm sure this has to be an Event Dispatch from one MC to another and that it can't be done by the Base class. how I can send an Event or Event Dispatch and what the code structure is so one movie clip can in one class can tell the other movie clip in the other class to disappear while it's neighbour is playing. I'm happy to post code or explain / clarify anything that's not clear.
View 1 Replies
Feb 23, 2011
I've got a main timeline .swf file called "blank.swf" which contains nothing but two blank movie clips one called called "pproduct", the other called "ppalette". In the script frame of this main timeline I use the simple "Loader = new Loader();" method to load a URL of an .swf file into the "ppalette" movie clip. The "ppalette" movie clip contains several color chip buttons, each of which use the same Loader method above to load an external .swf into a clip. Here's what I want to do: let those color chip buttons, when the "blank.swf" file loads, be used to load an .swf movie into the "pproduct" clip on the main timeline. I'm wanting to be able to swap depths with various movie clips which will take out the movie which has the palette, but I want whatever that palette has loaded in the original "pproduct" clip to stay there.
[Code]...
View 3 Replies
Oct 23, 2010
it seems simple enough but i have no idea on how i could get a movie clip to slowly move to the coordinates of another existing movie clip
View 5 Replies
Apr 8, 2012
I created a movie clip which plays ok. But when it ends there is a slight jump, if you will, when it goes back to frame 1 to begin playing again. Does anyone know how to make the transition unnoticeable from the last frame of a movie clip to the first frame of a movie clip?
View 4 Replies
Sep 7, 2010
iam tring to make a new project , i just wants to know how to make a movie clip ( constant speed ) follows anther movie clip <--- "which can be moved by the user "
<<<>>>> i believe that this idea is good , that i records the X and Y postion of the User's movie clip and just make the other movie clip points at this postion and move toward it ,
how to make the other Movie clip (( which is a car ! .. so it have acceleration , speed , steering , etc )) go to this position or let us say try to??
View 9 Replies
Mar 26, 2006
Q1) The registration point of a created clip is top left - my question is how can I dynamically change it's registration point - say to center center?
(I am trying to attach a movie clip to a created clip and I wanted it to be centered inside the container - a related sub-question, how can I find the x-y coordinates of the attached movie clip within the created movie clip?)
Q2)When I tried to create two different movie clips, I found I had to create them at different depths, else the first would load and the second would not. Why would that be so? I'm on MX 2004 Pro.
View 4 Replies
May 15, 2009
I have a very simple problem but I can't find the very simple solution to it. I've create an animated menu with animated movie clips inside to work as buttons. All the main buttons work perfectely but I've got just on button with a sub-menu. On this sub-menu I've placed an invisible hitarea button in order to place some gotoAndStop action. The thing is, it seems to me like this submenu hitarea are underneath something else (even though is the seccond layers right about the actions layers). I've placed a simple trace action whenever the mouse rolls over this area but I get nothing... Am I doing something really wrong? I'm losing all my hair already.
View 2 Replies
May 27, 2009
i am trying to use the Tween class to change the size of movie clip to certain height.the code works for me but when resizing the parent, it effects the child.i tried the height and scaleY property for the thum, but does not work.
ActionScript Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
[code]....
View 6 Replies
May 15, 2009
I've imported 9 .mov files in my flash presentation. Each lasts for about a minute, and the language is english. I have translation of each video clip in Serbian language as .txt files. And now i need that text to go below the movie clip simultaneosly with the voice in movie clip. And for example when i press pause,the text stops,and when i resume it,the text goes again.
View 1 Replies
Jun 30, 2009
it isn't such a big problem bur for a beginner like me it is.I have a movie clip called "Lion_beginning_mc", inside of it I have 3 Key Frames and Inside each and one of them I have different shapes.For example:Key Frame number 01 - DogKey Frame number 02 - CatKey Frame number 03 - MouseI want to move this movie clip "Lion Beginning_mc" form Key frame number 1 to Key frame number 20.I want the Dog,Cat and a mouse to change between each other only once while moving from Key Frame number 1 to 20.And then when the movie clip "Lion Beginning_mc" reaches his goal another movie clip or a frame (with a shape) will start.
View 5 Replies
Mar 25, 2011
I have in my root:
1 Movie Clip instancied as a "cursor" 1 Movie Clip instancied as a "Mc_Obstacles" with others 5 Movie Clipsand the 5 Movie Clips inside the "Mc_Obstacles" are instancied as "Obstacle" , all with the same instance...I want this: when the mc "cursor" hit one of mcs "obstacles" gotoandstop to frame X then i did in frame with actions in another layer:
cursor.onEnterFrame=function(){
this._x=this.x+10;
if(this.hitTest(Mc_Obstacles.Obstacle)){
gotoAndStop(4);
}
}
View 1 Replies