473,750 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Attaching a animation to a movie clip and calling it later

17 New Member
This is a project I have been working on lately and I keep running into problems.
The idea is to be able to attaching an animation to a movie clip and call it later. Or multiple animation at once.

example:
on the stage you have a black box called: myClip
in actionscript you type:
growClip = grow(myClip);
spinClip = spin(myClip);

now when you call:
growClip.run();
spinClip.run();
myClip will grow and spin.

These function are ran with setinterval but when I do this myClip only spins.

the function grow looks like this:
Expand|Select|Wrap|Line Numbers
  1. grow = function(mc,opts){
  2.     //opts == object containing required vars
  3.     opts.dir = (opts.dir > 0 || opts.dir == 0)?1:-1;
  4.     id=random(10000);
  5.  
  6.     mc["attach_animation"+id] = {}
  7.     co = mc["attach_animation"+id];
  8.     co.grow = {}
  9.     //Start: effect creation
  10.         co.grow.run = function(){
  11.             mc._xscale = mc._yscale = (opts.dir > 0)?0:100;
  12.             co.grow.growID = setInterval(co.grow.effect,5);
  13.         };
  14.         co.grow.kill = function(){
  15.             if(mc._xscale < 1) mc._visible = false;
  16.             mc._xscale = mc._yscale = 100;
  17.  
  18.             clearInterval(co.grow.growID);
  19.             delete co.grow;
  20.             trace("motion complete");
  21.         };
  22.         co.grow.effect = function(){
  23.             mc._xscale += opts.dir; 
  24.             mc._yscale = mc._xscale;
  25.             if(mc._xscale < 1 || mc._xscale > 100){
  26.                 co.grow.kill();
  27.             }
  28.         };
  29.         co.grow.growID = 0;
  30.  
  31.     //END: effect creation
  32.     return co.grow;
  33. }
  34.  
  35. growthis = grow(myClip,{dir:1});
  36. shrinkthis = grow(myClip,{dir:-1});
  37. growthis.run();
  38.  
The idea for the above code is from Adobe Spry framework

Does setInterval cancel if they are applied together?
Sep 6 '07 #1
1 1826
jsavagedesign
17 New Member
Well,

This is depressing because I have found that everything I was trying to do has already been done for you by Adobe (and of course done better).

I guess I am answering my own question here.
If anyone cares all you have to do is:

Expand|Select|Wrap|Line Numbers
  1. //your movie clip is named "myClip"
  2.  
  3. import mx.transitions.*;
  4. import mx.transitions.easing.*;
  5. TransitionManager.start(myClip, {type:Zoom, direction:Transition.IN, duration:2, easing:Elastic.easeOut});
  6.  
  7. //or
  8.  
  9. grow = new new TransitionManager(myClip);
  10. grow.startTransition({type:Zoom, direction:Transition.IN, duration:2, easing:Elastic.easeOut});
  11.  
  12. /*
  13. There are lots of these with differant easing just search "TransitionManager" in the flash Help under "Components Language Reference" book
  14. */
  15.  
  16. -J
  17.  
  18.  
  19.  
Sep 24 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3327
by: torbs | last post by:
I have a problem when I use javascript to get the length and position of a movie I recieve from a rtsp stream. The length and position is extremely high and not the actual length and position of the movie. When I try Real Player and it's methods I recieve a length and position of 0.
4
2792
by: petermichaux | last post by:
Hi, Is there any way to make DOM scripted animation smoother? Flash is far superior in this area. Any one here know what makes Flash so smooth by comparison? I don't like the fact that the standards based world is so far behind the Flash based stuff in some areas (animation and server push in particular)
10
4906
elamberdor
by: elamberdor | last post by:
Hello All! Well, I can load in swf's just loverly, but what I have is a sliding menu, with buttons in it, that when pressed, load an image into an empty movieclip. I really just need to know how to target back to the _root of the whole movie. It works great when the buttons and empty movieclip in the same stage or same movie clip, however I need to work out the right script to target right back to the root where i want the image to sit,...
0
2858
by: RLW | last post by:
Hi, I inherited a Flash usability problem: It's a self assessment test created in Flash. I think it was originally built using individual flash files for each question and arrays. Now it has been modified slightly. Each question is in it's own movie clip and the whole test (all the questions) is in a container clip. When the user checks a box they can no longer scroll using the MouseWheel on a PC.
2
3678
by: robtyketto | last post by:
Greetings, I have workable code to allow movie clips to be dragged around. However I can't find an example of a drag n drop where the movie clip has to be placed with a certain range/xy cordinates on a movie clip. For example I have a .gif of a grid of 2x2 squares how do I setup different instances of movie clips for each square to be able to detect when a object and has been dropped into it (A bit like when you can define hit areas on...
4
13913
by: Sin Jeong-hun | last post by:
Most applications, including Windows Explorer, show some sort of 'wait' dialog with animation when a lengthy operation is going on. For example, When the Windows Explorer is searching for something, it shows a small dialog with a moving flashlight. I examined the explorer.exe and found that that was an avi file. Now that, I would like to do similar thing in my C# application. But what is the most efficient way to do so? 1)Manually...
1
2088
Fary4u
by: Fary4u | last post by:
Hi i'm trying to design the picture gallery ever thing works fine but whn i've make test movie or export the swf file it's runs fine but problme i'm using this with in movie clip & i think so problm with level i've tried _level10 & 11 Also i've tried with _root & parent but no success any body know's where is the problem ?
1
5458
by: gusheneshin | last post by:
hi everyone im Using this code to Creat a Movie Clip and load a movie "SWF" into this Flash ------------ stop(); loady._x = 226.4;this.createEmptyMovieClip("loady",5);
1
3000
by: angelicdevil | last post by:
ok wat i m trying to do it get flash to read a xml file and load the titles in xml as a button into the imagetitles movie clip made on stage in flash . so that when i click on a title it displays the corresponding image, name and description form the xml onto the stage in respective movie clips. but its not loading the xml titles into the imagetitles movie clip i m uploading the zip file of the xml that i have at present ...plz check and...
0
9575
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6803
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4712
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4885
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3322
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2223
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.