How to flip a movie clip using actionscript
I have a movie clip on the stage facing one way (--->) how
can I make it face the other way (<---) by flipping it over (not
rotating it) using action script 3?
var flipTween:Tween = new Tween(mc, "scaleX", Regular.easeIn,
mc.scaleX, mc.scaleX*(-1), 1, true);
should do it I think.
Similar Messages
-
Creating instances of a movie clip using Actionscript
I have a script that pulls a specified amount of Movie clips
from the library to the stage, and that part of my script works. I
want to add a button that will stop the movie clips but the Movie
clips do not have instance names since they were pulled onto the
stage from my script. I was wondering if anyone had an idea on how
I can do this.stop();
var _sixSidedDie:Dice;
chooseDice_btn.addEventListener(MouseEvent.CLICK, onClick1);
random_mc.addEventListener(MouseEvent.CLICK, onClick2);
random_mc.buttonMode = true;
function onClick1(event:MouseEvent):void
var diceTotal:Number = parseInt(totalDice_cb.text);
gotoAndStop(2);
for(var i:Number = 0; i < diceTotal; i++)
_sixSidedDie = new Dice();
_sixSidedDie.label = "SixDie" + i;
_sixSidedDie.name = "sixDie" + i;
addChild(_sixSidedDie);
if(i == 0)
_sixSidedDie.frame = 2;
_sixSidedDie.x = 96;
_sixSidedDie.y = 115.7;
else if(0 < i && i < 5)
_sixSidedDie.frame = 2;
_sixSidedDie.x = i * 168 + 96;
_sixSidedDie.y = 115.7;
else if(4 < i && i < 10)
_sixSidedDie.frame = 2;
_sixSidedDie.x = (i - 5) * 168 + 96;
_sixSidedDie.y = 276;
else if(9 < i && i < 15)
_sixSidedDie.frame = 2;
_sixSidedDie.x = (i - 10) * 168 + 96;
_sixSidedDie.y = 438;
else if(14 < i && i < 20)
_sixSidedDie.frame = 2;
_sixSidedDie.x = (i - 15) * 168 + 96;
_sixSidedDie.y = 598;
function onClick2(event:MouseEvent):void
event.target.sixDie0.gotoAndStop(Math.ceil(Math.random() *
6)); -
How to control movie clips using mause scroller...?
....please look
http://www.nagaoka-id.ac.jp/gallery/gallery.html
...how to control movie clips using mause scroller...?Hi Ldavinci, I have noticed your posts on that particular
site before. Just chiming in here... don't be afraid of Flash Help
menu. There's a wealth of information there and I've found it much
faster than waiting for a response from the forum. Then if it still
doesn't make sense, at least you have a basic idea of specifics to
ask.
If you search for mouse wheel, you'll see an example under
the Actionscript 2.0 Language Reference on this topic. That said,
here's the example: -
How do I transfer movie clips from iPhoto to iPad?
How do I transfer movie clips from iphoto on my iMac, to my iPad?
You can use a USB flash drive & the camera connection kit.
Plug the USB flash drive into your computer & create a new folder titled DCIM. Then put your movie/photo files into the folder. The files must have a filename with exactly 8 characters long (no spaces) plus the file extension (i.e., my-movie.mov).
Now plug the flash drive into the iPad using the camera connection kit. Open the Photos app, the movie/photo files should appear & you can import.
Cheers, Tom -
Moving movie clips with ActionScript
I am trying to move four movie clips with actionscript in a
circler motion with two buttons, one to rotate the mc’s to
the left and one button to rotate the mc’s to the right. Here
is a link to what I am trying to do;
http://www.us.playstation.com/Lair/
and it is undrer game features.Yes, that's what the code I gave you is intended to do....
you replace that code with whatever action you need to take to turn
your movie around.
I have no idea what your movieclip is doing, but I'm guessing
by your response that if it was an arrow pointing left to right
(just an example), you want it to be pointing right to left when
the left arrow is pressed. If you want an immediate turn around,
then the simplest way to do that is to have another frame
containing the movieclip that it moves to where it faces the other
direction--and to have it appear turned around, from the toolbar
you select Modify -> Transform -> Flip Horizontal.
So the movieclip would live inside another movieclip that has
two frames with stop()'s for each frame. In the first frame you
would have the subclip facing left to right, and in the second you
would have it facing right to left. If we call that 2-framed
movieclip "walker", the code I provided before would
become... -
Casting a 3d movie clip in actionscript
Hello All,
I'm new to flash and actionscripting (i come from the land of ansi c but have traveled extensively). I've created a great animated animated 3d movie clip and want to have them generated on the stage in relation to an xml file. I've gotten this to work with a 2d movie clip but am running into problems casting a 3d object.
my object (a movie clip - boxContainer with an instance name of boxContainer_mc) is built out of all movie clips in the following way (shown in tree form):
boxContainer
-bottomBox
---boxFront
---boxLeft
---boxRight
---boxTop
---shadowFront
---shadowLeft
---shadowRight
---gradientLeft
---gradientRight
---gradientFront
-topBox (this movie clip contains an animation that is controlled through a MouseEvent:Click)
---left
---right
---top
---back
This animates smoothly through flash, but doesn't work when I try to cast the movie clip in actionscript 3 using the following code:
var boxContainer_mc:boxContainer = new boxContainer();
addChild(boxContainer_mc);
When I try to test the swf file I recieve the following errors:
1046: Type was not found or was not a compile-time constant:boxContainer
1180: Call to a possibly undefined method boxContainer
any ideas?If this is a library item that you named boxContainer in the library, you need to designate that name as the linkage ID for the movie. Right click on it in the library, select Linkage from the menu that appears, and in the interface that appears select the Export for Actionscript option (another will be slected automatically). Be sure your Class name appears as you have it coded and click ok.
-
How do I move a movie clip in actionscript 3.0?
Let me start off by thanking Everyone who have help me on Adobe Forums! it helps a ton i am new to actionscript and am trying my hardest to learn it so thank you i cant tell you how it means!
I have a movie clip of an acorn named "games" and inside this i have another movie clip named "em_games" when it is click i want to to play out an animation just changing the y coordinates from where the acorn sits in the tree and fall to the ground also when it hit the ground i want it to fire off an animation it has nested inside of it where it cracks open and a piece of paper fly upward where it rests at the top of the screen.i have not moved many objects through actionscript 3.0.
thanks again to everyone who has helped me out!One way to move an object using AS3 is to use the built-in Tween class. You should look it up in the help documentation for details, or search Google for a tutorial.
There are also third party tweening clsses such as TweenLite and Tweener that you could use, though if you are just beginning that might be a lesson better left to more experience since it involves downloading/installing the classes.
You could also just use an ENTER_FRAME approach to have the y property of the movieclip continually change until it reaches its final value. -
How do I backup movies/clips to use in future projects?
After burning my first DVD & deleting the iMovie file, I was sad to discover that I could not just pop the DVD into my drive & access the material to use in future projects. (Is there a way to do do this that I don't know about?)
I'm guessing I need to burn the archived iMovie file onto multiple regular CDs (I have not burned anything that spans several CDs before). This is confusing me because the zipped file is hardly smaller than the original (Is there a better zip program than the one that comes with this system?) I threw away the wrapper for my blank CDs so I don't know how much they hold but I think it is something ridiculously small like 670MB and the iMovie file is 7GB. Is this the only way to save my movie/clips so that I can bring clips into a future movie?
1.8 GHz Power PC G5 Mac OS X (10.3.9) 256 MB DDR SDRAMwelcome Novice to the board ....
hmm, multidimensional question ...
DVD is end-of-the-road, not meant for further processing; there are tools, allowing to import DVD to iM, but that is a time-consuming and lossy (=losing pic quality) process, due to the deliver-format nature of DVDs.... search forum for "DVD import"
iM is by concept not meant to handle a clip in many projects (that can easily been accomplished with pro tools as FC(E), which offer "bins" for imports, offering the content to many sequences/projects).
there are workarounds, dragging clips from the internal files of an iM project to another... but, as said: you "fumble" the concept: import tape, edit, burn - done.
a video contains ~13GB of data per hour... and, video is allready highly compressed, no zipper can reduce that dramatically... and, you risk damage of files... yepp, a cd-r fits ~700MB = 3.5min of video......
recommended workflow:
* don't store iM projects on -r media (cd/dvd), but firewire connected harddrives..
* keep the tapes; import clips from tape into project; you can export single clips out of iM/import into another project, I wouldn't do that with "lots" of clips, importing the tape is... more convenient.. -
How do I create a play button for movie clip using AS3
Hello.
Bit new to this and have been searching the adobe forums and google. I am trying to create a button that will play an imported MovieClip.
I have a movie clip that I've imported into it's own layer (Layer1) Frame 1. I've given the MovieClip an instance name of foundationMovie.
I've created a button and have that on its own layer(Layer2) above layer1, it is also in Frame 1.
I've added a
stop (); action to layer2
The video is not set to autoplay.
I want the video to start playing when the viewer clicks the button. I know I've got to put some kind of event listener using AS3 in my timeline somewhere.
I've found some code and I've been trying to work with it. I'm sure I've mutilated it beyond usability but this is what I've got.
stop ();
player.addEventListener(MouseEvent.CLICK,play);
function play(event:MouseEvent)
gotoAndPlay("foundationMovie");
If someone could point me the right direction or help me with my code I would really appreciate it. Thanks.First, you need to clear up what you are working with... a movieclip and a video are usually entirely different things.
Next, your code may get you started on your way with some changes. You shouldn't use "play" as a function name due to there already being a play() method/function in Flash.
If the movieclip is a movieclip and has an instance name of "foundationMovie", and your button has an instance name of "player" then the following adjusted code would normally work...
stop ();
player.addEventListener(MouseEvent.CLICK,playMovie);
function playMovie(event:MouseEvent)
foundationMovie.play(); -
How do i mute the sound in a movie clip using action script?
assuming my movie clip is named "movie"
You should use SoundTranfrom object and soundTransform property of your movieClip.
At first you have to instantiate soundTransform object and assign value of 1 to it's volume property:
var soundTr:SoundTransform = new SoundTransform();
soundTr.volume = 1;
Than a simple toggle function, which changes volume property of soundTr and assigns the object soundTr to your movie's soundTransform property.
function toggleMute():void
if(soundTr.volume == 1)
soundTr.volume = 0;
}else{
soundTr.volume = 1;
movie.soundTransform = soundTr;
Regards,
gc -
How can I burn Movie clips to Lightroom using DVD-RW disk
I have edited a file containg 2 dozen still photos and 7 movie clips. Although I can burn the still photos by clicking on EXPORT I am later told (but not the reason why) that the Movie clips did not successfully burn to disk.
AFAIK, there's no way to do that with Premiere Pro. You can probably find a utility on the Internet that will change the dates for you after the fact.
Cheers,
Jeff -
How do I recerence Movie Clips on the Main Timeline from inside a class?
Hey everyone, this might be a stupid question but I thought
I'd ask cause it's making me nuts. I'm all of 2 days into AS3
(coming from not using Flash at all in YEARS) so feel free to
consider me ignorant. I do have plenty of application development
experience in other areas though.
I can't seem to create a class that can reference an instance
of a movie clip on my main timeline. I'd post code of what I've
tried but I've gone through so many desperate edits & wild
guesses that it was just garbled junk before I deleted it all.
Basically here's how I figured Flash could work, though maybe
it doesn't work this way at all.
I'm assuming that with AS 3 being so big on being a true
object oriented environment, I wouldn't need to mix my code and
interface together. Preferably I'd be using the Flash authoring
tools just to design my interface. Create a button... place it
somewhere... give it an instance name. Roughly the equivilant of
Apple's InterfaceBuilder for those of you that might be familiar
with Cocoa development. I can see maybe having to put a few lines
of ActionScript onto frame 1 (though really I'm hoping Flash would
have a better method of kicking off the application at this point
that using code tied to frames) to load my classes & such, but
after that I'd like all of my code to be held in external class
files.
So maybe I've got:
Interface.fla - My interface
Button_1
Button_2
TextField_1
Main.as - My main controller class using to handle all of my
applications behavior
SomeClass.as - Some helper Class
SomeOtherClass.as - Some helper Class
Main.as would have instructions in its initialization method
to go ahead & attach events to buttons & initialize
anything else that needs to happen when the application starts.
From there on it would all be objects communicating back &
forth. Button_1 would get clicked with would fire
Main.someMethod(). Main.someMethod() would then do it's thing and
set the value of TextField_1. All very clean & code is very
separated from interface.
Unfortunately I can't for the life of me figure out how AS3
classes reference each other like that. There doesn't seem to be
any kind of a global 'root' or '_root' I can use to locate any
movie clips on the stage. I've searched the help & the web for
any kind of simple tutorial but to no avail. My job has tasked me
with building a flash app for a project but I'd really rather not
have a tone of ActionScript just shoved into frame 1. That just
seems... ugh! (::shudder::)
Can someone maybe point me in the right direction here? I'm
really willing to do my homework but I can't seem to locate the
info I need to get started. Also, is there an ActionScript IRC
channel or something maybe?
Thanks,
CliffI worked with the problem last night and the solution I
started coming to involved creating my own custom document class
based off which extends MovieClip. My thought is that way I have
access to the initialization routine of the timeline itself and
that all of the elements on the main timeline should be
"properties" of my custom class.
Is this correct? Is there a down side to doing this & if
so what is it & why?
Also, just for my reference, the last time I did anything
with ActionScript I think I was using '_root' to target the main
timeline. WHat are the global variable names in AS 3? Is it just
'root' & 'stage' or 'Root' & 'Stage' or what? -
How to stop a movie clip that is loaded dynamically
Hello Flash Forum,
I am using the loadmovie method to load a swf file into a
movie clip "container"
Code snippet:
var mc:MovieClip = this.createEmptyMovieClip("mc",1);
mc.loadMovie('bbc_module1.1.swf','bbc_audio',container.getNextHighestDepth(),
{_x:300.8, _y:240});
mc._lockroot = true;
The movie clip I load does not have a stop action in frame 1,
but comes up playing (audio and images). I am not using video. It
is a series of still images synced to the audio.
I would like to be able to load the movie clip, stop it from
playing, and by clicking buttons, get it to play, pause, etc like
the buttons and skin on the FLVPlayer.
Any tips on how to do this?
Thanks,
eholz1Many thanks ClBeech!!!
I've tried the code you suggested but it doesn't seem to work
:0(
I'm working on a Mac using Flash Pro 8 which only has the
option to publish as 'actionscript 1.0 or 2.0' is the script you
supplied an actionscript 3.0?
Below is the script with the amendments, I've changed my
button instance names to match the script you supplied (left_btn /
right_btn)
stop();
import mx.transitions.Tween;
import mx.transitions.easing.Strong;
var rposX = 369;
//the ending x of the right position
var rposY = 84;
//the ending y of the right position
var lposX = 116;
//the ending x of the left position
var lposY = 154;
//the ending y of the left position
right_btn.onPress = function() {
new Tween(content1, '_x', Strong.easeOut, content1._x,
rposX, time, false);
new Tween(content1, '_y', Strong.easeOut, content1._y,
rposY, time, false);
left_btn.onPress = function() {
new Tween(content1, '_x', Strong.easeOut, content1._x,
lposX, time, false);
new Tween(content1, '_y', Strong.easeOut, content1._y,
lposY, time, false); -
How do I create a Sequence using Actionscript?
Suppose I've got 2 movie clips on the stage. box_mc and triangle_mc
I want to set up a way so that whenever I trigger the event, such as pressing a key (like
if(Key.isDown(Key.SPACE)){
//stuff that activates it
it does the following in order, spaced by 1 frame, or 1 second (or a specific number of frames)
[1] box_mc._rotation = -45;
[2]triangle_mc._rotation = 45;
[3]box_mc._rotation = 0;
[4]triangle_mc._rotation = 0;
if I push the Space key again, it would start from the top (1) and repeat the sequence. The sequence would otherwise stop at 4. Previously I've been using counters inside an onEnterFrame such as counter = counter +1; if counter > n, counter = n; etc. This seems tedious and I'm hoping there's a better way to do this. I do not understand watch and timer functions of actionscript (they never seem to work for whatever project I'm occupied with).
Thanks!it definitely worked this time. I edited it for gear appearances and it looks ok:
function startSequenceF(){
rotateF(box_mc,-45);
clearTimeout(rotate1I);
clearTimeout(rotate2I);
clearTimeout(rotate3I);
clearTimeout(rotate4I);
clearTimeout(rotate5I);
clearTimeout(rotate6I);
clearTimeout(rotate7I);
rotate1I=setTimeout(rotateF,200,box_mc.triangle_mc,30)
rotate2I=setTimeout(rotateF,400,box_mc,-90);
rotate3I=setTimeout(rotateF,600,box_mc.triangle_mc,60);
rotate4I=setTimeout(rotateF,800,box_mc,-135);
rotate5I=setTimeout(rotateF,1000,box_mc.triangle_mc,90);
rotate6I=setTimeout(rotateF,1200,box_mc,-180);
rotate7I=setTimeout(rotateF,1400,box_mc.triangle_mc,0);
function rotateF(mc:MovieClip,angle:Number){
mc._rotation = angle; // or animate this
// and to start everything going use:
onEnterFrame = function(){
if(Key.isDown(Key.SPACE)){
startSequenceF();
my next question would probably be "How can I make these changes more graceful/fluid", or would I have to make several minute changes of a few degrees each? -
How to create a movie clip during runtime?
I'm learning basic shooter games and my goal is to have a small circle movie clip (would it work as a movie clip?) spawn when the mouse button is pressed. I know how to add the code for the button being pressed, but I do not know how to create the object on demand. Can you please help me with this?
For AS2, you right click the movieclip symbol in the library and select the Linkage... option. In the panel that appears you select the first option (Export for Actionscript) and another is automatically selected. Then you assign an Identifier for it in the field at the top. To add that movieclip to the stage you use the attachMovie() method... for example...
this.attachMovie("linkageIdentifier", "instanceName", this.getNextHighestDepth());
In AS3 it is somewhat similar as far as assigning an Identifier, except you assign a Class name instead, and then add a new item to the stage as a new instance of the class...
var instanceName:ClassIdentifier = new ClassIdentifier();
Maybe you are looking for
-
How to Delete Multiple Subscriptions in iCal
Hi everybody ... I've a problem with iCal cause it show me more than 100 subscriptions as birthdays etc .... i tried a method i found on the web to reset it completely but after a while it show everything back once again! I hate it! It is really slow
-
W520 dock 433830U in good supply
The mini dock for the W520 is available in quantity. I just bought one brand new (my second) from eBay for $160 shipped; not to say some sellers aren't trying for a lot more. Buy and Amazon both have them in the the $214 - $225 range: 433830U dock So
-
I want to execute a addon of R3 from VBA.
Dear all. (sorry not good English) I want to execute a addon of R3 from VBA. The addon have 'commit' multiple times. I am using "RFC_CALL_TRANSACTION_USING" from VBA. but, addon is finished by one commitment processing. I want to execute a addon cont
-
HOW TO CREATE PRODUCTION SCHEDULING PROFILE
PLEASE TELL ME HOW TO CREATE PRODUCTION SCHEDULING PROFILE EXPLAIN IN STEPS THANKS
-
Specifications in Result Recording
Hi QM Gurus, Here I encountered an interesting problem, Lower and Upper specification limit have been maintained in inspection plan. However, when make result recording the Lower and Upper specification limit are not transported into result recording