How Can I Reverse And Instance?
I have seen the posts about reversing movie clips but I am tring to use a function instead of a full MC.
I have an instance named "landscape". The _xscale=300. This is used with the function
_root.movePieceright(This);
This code sets the x limits
if (_x>0) { _x = 0; } if (_x<400-_width) { _x = (400-_width); }
Next I have a button with code
on (release) { if (_x>=0) { function movePieceright (Landscape) { with (Landscape) { _x += -2; } } } }
This starts moving the instance to the right until it reaches limit.
Is it possible to have another function movePieceleft take over and move the instance to the left when the right limit is reached?
FlashKit > Flash Help > Flash ActionScript
Posted on: 04-16-2002, 08:50 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Instance Names...changing...or Addressing Txt Field Instance Based On Instance Of Mc
i'm creating a mail form, that has a text effect which displays the type of info to be entered in each input box. To create this effect, i had to assign the variable name txt to the input boxes as well as the instance name txtBox. each of these text fields is contained within a movieclip, each with a unique instance name. what i need to do, is somehow assign a value/variable to each text field to pass to PHP to generate an email. I have always used components for contact forms so i'm not sure how to make the switch, AND.. the script i use for my contact form is an EXTERNAL AS file. (i use a customized version of a contact form from www.actionscript-toolbox.com [which apparently is no longer Flash related site])
ok.. this is hard to explain..... so bear with me....
If my original mail form component instance names were: tiName, tiEmail, tiSubject and taMsg (ti for textInput and ta for textArea)
and my current instance names for the mc's which CONTAIN the input boxes (with txtBox textfield instance inside them) are: name_txt, email_txt, subject_txt & comments_txt...
how would i pass/convert the users input text in each movieclip's txtBox, into the original instance name for my mail form so i can continue to use the form/PHP i have been using??
OR....
how do i take the values input by the user in each txtBox (i.e name_txt.txtBox.insertedTextFromUser or name_txt.txt, email_txt.txtBox.insertedTextFromUser or email_txt.txt) and send them to a new PHP script to send mail??
please keep in mind i am PHP retarded... hence why i re-use the same form over and over..
thanks in advance for any help. it's greatly appreciated...
if you're confused about my problem, please let me know... i'm having a difficult time explaining....
How Do You Reverse Your Animation Or Do A Reverse Wipe...
...when loading a new movie or going to a new scene? In other words, when a new movie is fading in and then stoping to reveal buttons or navigation, how do you tell your movie to reverse your frames or reverse the intro animation, then go to and play a new movie? I apoligize it's hard to explain. Here is an example...
http://www.djstevelawler.com/
1)enter the site
2)skip the intro
3)you will then see the turntable and all of the animation fade in along with a drumset that if clicked reveals your navigation.
4)click on "chart" for example
5)the entire animation reverses itself or fades out the way it first came in, this is the effect that I'm after.
6)the chart page fades in along with the navigation
7)clicking the back button and the chart page fades out again just as it faded in and load the portal page.
Please help me out with this. Even if you can point me toward a tutorial I would be extremely grateful.
Thanks!
Access Property/function Of Instance From Inside Another Instance
Might be something really obvious, but I'm still trying to get my head round as3...
I need to call up a property and function of another instance of the same class, similar as in as2 (called from within "_root.instance_mc1"):
ActionScript Code:
_root.instance_mc2.someNumber = 0;
_root.instance_mc2.someFunction();
Now in AS3 I can access the object (extending sprite) itself (and inherited properties like x) by using:
ActionScript Code:
this.parent.getChildByName("row2").x
but if i try to access public variables/functions from that object (this.parent.getChildByName("row2").someNumber) I get Error 1119: Access of possibly undefined property someNumber through a reference with static type flash.displayisplayObject.
Anyone know how I can get this to work?
Code In One Instance Is Referencing The Previous Instance
I have the following code in a button symbol:
on (release) {
gotoAndStop (2);
_root["answer" + this._name.substr(1)] = "true";
}
I also have an instance of the button in 2 consecutive keyframes. The first instance is named "Q5" and the second instance is "Q6".
I expected the code: this._name.substr(1)]
to reference "5" and "6" from the instance names (Q5 and Q6), but instead instance "Q6" is referencing "Q5"!
The *really* strange thing, is that when I insert a blank keyframe between the two original keyframes, the code works perfectly!
Does anyone know what's happening?
[MX04] Get Instance Name Of Rolled Over Array Instance
Hi
I am willing to do a rollover image gallery which enlarges image on rollover event and shifts the neighbouring ones aside..
Here is the code so far
Code:
_root.bttn.onRelease = function() {
createGallery();
};
function createGallery() {
var row11:Array = new Array("DSCF5659", "DSCF5807q", "DSCF5773q");
for (i in row11) {
_root.createEmptyMovieClip(row11[i], _root.getNextHighestDepth());
_root[row11[i]].loadMovie("segi/"+row11[i]+"small.jpg", [row11[i]]);
_root[row11[i]]._x = i*150;
}
}
_root.onEnterFrame = function() {
function roll() {
var row11:Array = new Array("DSCF5659", "DSCF5807q", "DSCF5773q");
for (i;i<row11.length;i++) {
_root[row11[i]].onRollOver = function() {
this._xscale += 10;
};
}
}
roll();
};
What I would like to do is to:
ask flash which particular movieclip was rolled over , what is its instance name and than perform string operation to get a number (order) of that clip (I am naming all dynamically with image name + number in order)
Can anyone help me please ???
Thanx in advance
How Do I Copy A Sprite Instance Into A BitmapData Instance?
I apologize if this is covered elsewhere: I just don't even know what terms to search on to find what I'm looking for...
I have a sprite that receives various user-drawn lines on it during runtime. I would like to be able to copy this Sprite into a BitmapData instance, then send the pixels from the BitmapData instance to a PHP script. I think I'll be all right with the PHP end of things, but I just don't know how to copy my Sprite into a BitmapData.
(If there were a way to just use BitmapData and use the moveTo, lineTo, mouseX, mouseY, etc, methods, then I'd do that, but I don't even know if that's possible...Obviously, I'm not as well-versed in AS3 as I'd like to be.)
Thanks in advance for any help!
Instance On Top / Movie Instance Depth
Hi everyone,
I would like to know how, if possible, i can get the depth of a movie instance. Basically I just want to make the movie instance clicked on on top of all the others. I was going to try to do this using the swapdepths action but if anyone knows of a better way please tell me!
thanks a lot
jordan woolley
Returning The Instance Name Of A Class From Within The Instance
Hi,
I'm trying to do some error reporting in my actionscript.
I have a class MyData which can be instantiated several times over in each project e.g.
var myData1:MyData = new MyData();
var myData2:MyData = new MyData();
In the error reporting I have put statements like
trace("MyData.loadData reports error.... message...");
However, I'd really like it to return the instantiated name, not the generic class name so that I can trace errors to the particular instance that is failing. Does anyone know how to do this? I've tried
trace(this.toString() + " reports error.... message...");
but I just get a name of [object object] which isn't that helpful!
Many thanks!
Removing Instance X Inside Instance X
In Flash CS3 in library I have a MovieClip symbol Help (exported for AS).
The function below opens an instance of the symbol when the button is clicked.
ActionScript Code:
function showHelp(e:MouseEvent):void {
var helpwindow:Help = new Help();
helpwindow.x = 50;
helpwindow.y = 50;
addChild(helpwindow);
}
This works and instance "helpwindow" shows on the screen.
Now inside the symbol Help i have another button which will run a function that would close that instance. How do I get rid of that instance? I was trying with removeChild but errors occurr.
ActionScript Code:
function removeHelp(e:MouseEvent):void {
removeChild(MovieClip(parent).helpwindow);
}
Quote:
TypeError: Error #2007: Parameter child must be non-null.
How To Call The Instance Name Inside That Instance?
Ok this is what I want...
I am inside an instance of a movie clip. And I want to access the properties of this movie clip. Now the problem is (if) I don't know the name of the instance of the movie clip (suppose I create the instance of the movie clip on the fly!!!), how do i refer to the name of the instance.
Is there something called this. in actionscript?
Any help would be appriciated!!!
Sushubh
Dynamic Instance Name Vs Manual Instance Name?
Hello,
I would like to access this object (taken from Debug > List Objects of in flash player)
ActionScript Code:
Target="_level0.promotion0.loader_mc.instance87.promo TXT"
This is what I am trying to access it with:
ActionScript Code:
trace( this.getChildByName("promotion0").loader_mc.getChildByName("instance87").promoTXT.text );
Error:
ActionScript Code:
1119: Access of possibly undefined property loader_mc through a reference with static type flash.displayisplayObject.
what is the correct way to do this?
How To Get Button's Instance Name On Stage? OR Can A Button Ahve 2 Instance Names?
i have a button the the stage, with an instance name of: "butt1"
the button itself lives inside a movieclip, where it is called thisButton
when flash runs and I click the button I want to output the button's instance name on the stage (i.e. butt1) but i'm only getting the button's instance name in it's own movie
this._name gives me = thisButton
is the name i want stored in a separate property?
edit: sorry - i realise that the problem is that the button code is inside the mc itself, where the button's name is thisButton
Instance Name Instead Of Instance Number
hey there,
the following code returns strange names for the instance: I get 'instance61' and 'instance55' when clicking the button in the MC named 'tabber'. I would expect to see 'tab' and 'tab2'.
Is there a way to get the instance name instead of the instance number?
cheers!
PHP Code:
package { import flash.display.MovieClip; import flash.events.MouseEvent; import flash.display.SimpleButton; public class content extends MovieClip { public function content() { //content.stop(); var tab:tabber = new tabber(); tab.x=118; tab.y=75; tab.butt.addEventListener(MouseEvent.CLICK, ms2); addChildAt(tab,1); var tab2:tabber = new tabber(); tab2.x=228; tab2.y=75; tab2.butt.addEventListener(MouseEvent.CLICK, ms2); addChildAt(tab2,1); } function ms(event:MouseEvent):void { trace(event.target.parent.name); } }}
Any Way To For A Class Instance To Ask What Its Instance Name Is?
Hey. I have a class which needs to create a movie clip on the stage. Since each instance of the class will only ever have 1 movie clip on the stage at a time, it seems reasonable that I have the instance create a movie clip with its own name, prefixed with "mc_" or something of the sort.
Here's where I don't know quite what to do... How do I get at this information? For instance, when you a dealing with an XMLNode, you can simply use...
the_answer = xmlNodeInstance.nodeName;
...I know the analogy fails, but hopefully you know what I'm looking for.
Thanks!
Calling An Instance Within An Instance
Hi,
I've got 3 movieclip buttons with instance name, "btn1", "btn2" and "btn3". Inside these clips is another movieclip named "mousedetect".
How do I use a loop on the "mousedetect" movieclip to initiate an action? Without a loop it will look like this:
btn1.mousedetect.onRelease=functiion(){
btnRelease();
}
I've tried something like:
for (i=1;i<=3;i++){
this["btn"+i].mousedetect.onRelease=function(){
btnRelease();
}
}
but an error shows up, what should be the correct syntax?
Thanks!
Want Opening Movie Clip Instance To Close Underlying Movie Clip Instance
Just so you all know, I'm one of three people in our company that uses Flash and I'm considered "the expert". However, we don't do more than a few Flash projects a year, so my scripting knowledge is very, very green. Thanks in advance for your patience.
I have 22 buttons that play an assigned movie clip from the library. I suspect I'm building these things the wrong way (probably true), but here is how each button is constructed....
Each instance that I'm calling a button is actually identified as a movie clip intance with a button in it. It sits on its own layer. When I double-click an instance, several layers are displayed, the majority of which belong to the presentation of the movie clip. The clip lasts five frames.
The first frame consists of blank keyframes for each layer except for one layer that has stop() assigned to the frame and another layer with the actual button. The layer with stop() at frame 1 is then blank for the next three frames, and then another stop() on frame 5 (the last frame).
The button layer lasts all five frames. Here's the script for "display1980":
on (rollOver) {
_root.display1981.gotoandstop(1);
_root.display1982.gotoandstop(1);
_root.display1983.gotoandstop(1);
.
.
.
_root.display2003.gotoandstop(1);
_root.display2004.gotoandstop(1);
_root.display2005.gotoandstop(1);}
on (release) {
_root.Play();
play();
}
For each instance, there is no line of script that refers to itself. In this example for display1980, "_root.display1980.gotoandstop(1);" is not used.
As I mentioned earlier, each instance is on the main stage on its own layer. I've done this with only eight of my instances, so there are now eight layers. (There are--in fact--more than eight layers, but those are not part of this issue.)
The script I created does the job of getting rid of any previously displayed movie clip, but I created a new conumdrum: If I rollover any other button, the currently displayed clip closes. I've tried replacing "on (rollOver)" with "on (press)" but that doesn't work.
Like I said, I suspect I'm buildng this wrong. Is what I built a waste of time, or can it be salvaged? Or, is there a much better and efficient way (and I suppose there is) that can be described so that my green experience can absorb to good effect?
Reverse An MC
yes my flash bible would answer this question quickly but I dont have it!! please help
what is the action to reverse movie please?
How To Reverse
How do you make a movieclip reverse ?
i mean make them go back after a certain time (for instance at then end of the movieclip)
Thx guys
Reverse MC?
Is there any way of getting a movie clip to play in reverse
Ive asigned a button to play a movie clip but I want the movie clip to play in reverse is this possible
Reverse The MC
What could be added to this code to keep the MC playing in reverse instead of moving back just one frame while the mouse is over the button?
on (rollOver) {
if (_currentframe>1) {
prevFrame();
}
}
on (rollOut) {
stop();
}
Thank you,
JF
XML In Reverse
i had this problem like a year ago, but i forgot what it was
i have an xml document like:
[ things ]
___[ a / ]
___[ b / ]
___[ c / ]
[ / things ]
i load the xml, put these into an array and get them out using a for..in loop
so i tested this before i hit the submit button
when i use the for..in, it goes backwards
if i get the maxLen of the array and use a for loop, it works fine
funny huh?
Reverse
Can someone tell me why this would not work for me as a Button action..
on (press) {
while (this.textMc._currentframe>1) {
// keep playing the previous frame...
this.textMc.prevFrame();
}
}
// if the mouse is NOT over the clip
on (release) {
this.textMc.stop();
}
OR EVEN THIS....
on (press) {
if(this.textMc._currentframe>1) {
// keep playing the previous frame...
this.textMc.prevFrame();
}else{
stop();
}
}
// if button is released
on (release) {
this.textMc.stop();
}
I wanted the simplest possible way of making a movie play backward,,,
Many thanks
Getting A Gif To Reverse?
Hi i hope this doesnt post twice i already did it once and it never posted sorry if it does. I have a gif that i want to reverse. I have my image going one way now i want it to go another way. Any ideas on how to do this? Thanks
Reverse?
hi,
workin with a menu which tells a certain swf. to load. i want to know if there's a way to have
1. the button which tells to unload a movie
AND
2. tell the same movie to play reverse. something with tellTarget maybe?
i have this action on the button:
on (press) {
unloadMovie("bio.swf");
thanks in advance,
noodle
How To Reverse An MC
Hello,
I have an MC that contains a video that's 175 frames long. I'd like it to play forward and backward endlessly but I can't figure out how to reverse it so that I can paste the reverse onto the end of the forward clip or how to script it so that when it reaches the end of the clip it plays itself backwards. Seems so simple, yet I can't get it.
Much appreciated,
Llyfre
Reverse
Ok,
Here is what i am trying to do. I am trying to make a slide show. And it intels pictures. Well anyway, I want this slidshow to have a certain feature when a user press on a pic the lets say he or she press on the 9th pic and the slides will scroll to that pic. well here is the tricky part. If he or she press on the third pic, then the slides will scroll back to the third pic. How can I do this? what source will I need to look up? Thanks All.
Reverse
Ok,
Here is what i am trying to do. I am trying to make a slide show. And it intels pictures. Well anyway, I want this slidshow to have a certain feature when a user press on a pic the lets say he or she press on the 9th pic and the slides will scroll to that pic. well here is the tricky part. If he or she press on the third pic, then the slides will scroll back to the third pic. How can I do this? what source will I need to look up? Thanks All.
Reverse
I'm using the follwing AS to f & R the MC.
onClipEvent (load) {
centerPoint = 390;
}
onClipEvent (enterFrame) {
_x += (centerPoint-_root._xmouse)/10;
}
My stumbling block and question is this, can the MC be stopped/paused, if so
what would be the AS if it is possible. I have 2 books in which none speak of the ability to stop or pause the clip.
Thanks,
FlashDummy
p.s. Great site
Reverse A M.c. In Mx To Pro 8
does anyone know if actionscript has changed in the flash pro 8 from flash mx. i have tried the same exact code to play and reverse a m.c. on mouse rollOver and rollOut. and the same code doesn't work in pro 8 as it does in flash mx. does anyone have any ideas. i am desperate.
thanks,
jeff
How To Reverse An M
Hello,
I have an MC that contains a video that's 175 frames long. I'd like it to play forward and backward endlessly but I can't figure out how to reverse it so that I can paste the reverse onto the end of the forward clip or how to script it so that when it reaches the end of the clip it plays itself backwards. Seems so simple, yet I can't get it.
Much appreciated,
Llyfre
Reverse
Hi Me Again
I had a question ---- Is it possible to play a timeline in reverse order? ---- by that I mean ---- Imagine a ball animated to move from left to right --- is there any way by which the play head can be made to move in reverse order---- that is without animating the motion back---- i.e. form right to left....
Reverse AS?
Alright I have a pretty big animation with alot of letters in it where they change from one color to white now I don't want to spend alot of time doing it so that it would fade back to blue in the same order it did the first time so is there some type of actionscript where It would play it but backwards and then start the animation again?
Like gotoAndPlay(80) = reverse; or something?
EDIT/ and I know that my title is Reverse AC it should be AS lol.
Reverse MC
Able to get the swap function to work but seem can't get the reverse function to work (prefFrame):
Code:
var swaps:Array = [one, two, three, four, five];
var highest:Number = _root.getNextHighestDepth();
var current:Number;
for (i=0; i<swaps.length; i++) {
swaps[i].onRollOver = function() {
current = this.getDepth();
this.swapDepths(highest);
this.gotoAndPlay(2);
};
swaps[i].onRollOut = function() {
this.swapDepths(current);
this.onEnterFrame = function(){
prevFrame();
}
};
}
The functions I'm attempting to simulate is similar to this concept: http://www.templatemonster.com/flash...ates/8785.html
Any suggestion or better functions than above?
Thanks,
Friggin' Mick
Reverse The MC
OK - I'm been searching the forum, and found some useful information, but I still can't get it to work the way I would like it to.
Here the thing, I've made a simple animation and ONE button. When you RollOver the button the animation STARTS to play, and when RollOut the animation plays backward (prevFrame)..
I'm kinda stuck here, found alot of useful code in here, but I can't figure out how to put it together so it will work my way!
So ANY help would be NICE!
Oh, and BTW the animation needs to be stoped at the last frame!
Reverse
I wouold like to make an interactive button be able to reverse action in a scene. Any ideas?
In Reverse
hey,
Well, i got flash 8 about 2 days ago and have been teaching myself without tutorials, anyways im having a problem... say i press the left arrow key to make the box for instance move left then when i press cntrl+enter the animation is in reverse :S please help us.
Alex
How To Reverse Movement
Hi, I'm a newbie in scripting. Anyways, here's the scenario:
I have a bouncing ball (using regular tweens). It then moves from left to right using:
this._x = this._x + six;
Then, as soon as it hits a certain point, say, 500 pixels, I'd like to reverse it. Si I added an <if> condition, that says this: (I'll just add the whole script!)
onClipEvent (enterFrame) {
six = 10;
end = 400;
if (this._x >=end) {
this._x = this._x - six;
} else {
this._x = this._x + six;
}
}
So as soon as it hits the "wall", it should reverse, and it does for one step, but then it goes back again, and is stuck in an oscillating movement. Perhaps someone could help explain how to keep the ball moving backwards???
thanx
Reverse Movie
can I use action script to reverse a movie.
I'm working on a rotating UI and want to use buttons to control the direction of the rotation. Any suggestion on how to achieve this would be very welcome. I can send a file with the movies in it.
I've seen action scripts that make things rotate in place. But I need icons to rotate around a center and stay still (not around around their own center as well)
[Edited by sandbender on 07-11-2001 at 06:25 PM]
Reverse Directions?
Here is my code:
onClipEvent(enterFrame) {
this._x = this._x * 0.95;
}
How can I make this object travel from left to right instead of the other way around? I know I can just change 0.95 to a whole number, but then it won't ever stop. I want to have the 'friction' effect to it, but I can't seem to get it to work. Putting a negative sign in front of it didn't seem to work, or maybe I'm doing it wrong?
Reverse Movies
I have a question, how do you 'reverse' a movie when its finished.
I would like my movie to go back and stop after the user clicked on a button. How ............?
Thx guys
Play In Reverse?
Hey FlashFriends,
I have a button with a mouseover event of on press play, on release stop. I have another button that i want to attribute the same action to, but the play to play reverse.
Possible?
Thanks for any help....
Jonathan
Play Reverse
I have a Movieclip and I want a button inside it to make the movieclip play backwards.
Dissolve In Reverse?
How might I go about doing this effect in reverse? Instead of disappearing, I would like text to apparate. I've tried reversing the frame order afterward, but instead of flipping/rotating throught motion tween, the item just moves toward the second keyframe in a rather unimpressive way. Here's the example:
http://www.flashkit.com/tutorials/Te...47/index.shtml
Movies In Reverse
Hello everyone at Flaskkit!!!......I enjoy your site, and it has helped me drastically with the progression of my newly designed, interactive flash website. Thanx to all who helped.
I was wondering if it is possible to play a motion tween in reverse. Rather than having to complete a new motion tween with the same effects, i would prefer to just play it backwards. Nothing seems impossible with Flash 5.0, but I may be getting carried away with the endless functions. Anyone with help/comments/suggestions please inform me.
Your help is much appreciated,
Thank you.
Xtrem Rukus
How To Reverse MC's Movement?
Hi, I'm a newbie at actionscript and would like to know how make an object reverse it's movement after reaching a certain point...Here's my movement script:
onClipEvent (enterFrame) {
this._x=this._x+10;
}
That'll make it slide across the screen. But if I'd like it to reverse after it reaches, say x=600, how do I proceed?
Thanks....
Reverse Script Help Please.
I have a small problem, well Iˇ¦m just practicing. Ok picture this;
I have two buttons, one that when pressed plays the movie clip, and stops when released.
on (press) {
tellTarget ("mc") {
play ();
}
}
on (release) {
tellTarget ("mc") {
stop ();
}
}
So far so good! Now for the other button I want it to reverse the movie. So far I have got this;
on (press) {
tellTarget ("mc") {
prevFrame ();
}
}
on (release) {
tellTarget ("mc") {
stop ();
}
}
Doesnˇ¦t work how I want, you see it only goes to the previous frame one at time, and this is only if you keep clicking the button! I need a smooth reverse by pressing and holding down the mouse button.
How would I do this?
Reverse Movieclip
Once I have created a button that triggers a movieclip on a rollover state, how can I get the movie to play backwards on the release state?
Reverse Loading Of MC's
Hello again...OK this is a another MAJOR irritant.
I am loading a few different swf's in a LOADING main file when corrosponding keys are pressed. This happens in chronological orde ...that is..1.swf and then 2.swf etc.
They are loaded into a MC on the main timeline(root)
Each of tehse MC's is movable UP-DOWN using cursors to read the whole file.
Now a button in 1.swf lets me load 2.swf , etc.
But if I go in reverse and load 1.swf from 2.swf then a problem occurs. 1.swf loads from its originl position, but I wud like it to be loaded in its last position.
Can anyone HElp?..
Thanx
|