Strange? Adding Tween Replaces Symbol
Hi,
This is really wierd. I have a movie in which I need to tween images in and out. Most work fine, but some of the images seem to swap as soon as I add a tween.
Is this some kind of bug?
FlashKit > Flash Help > Flash MX
Posted on: 02-18-2005, 05:50 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Using Stop(); On A Shape Tween Of A Swapped Movie Clip Symbol Within A Motion Tween
Thanks a lot for your time. I'm new to actionscript, and language syntax and I never really got along to begin with so I appreciate any help in the matter.
Basically the title says it all - I made a motion tween in the main scene, made a movie clip symbol (to shape tween a gradient) and added a stop(); inside the gradient-tweened-symbol. I then swapped the movie clip symbol with the motion tween in the main scene, and got exactly the effect I wanted (the item moved, then tweened itself) but the stop(); seems to have no effect.
I know this looks like one of those "that idiot didn't google before posting" questions, but I've been looking for about a half hour with different permutations of stop, doesn't work, actionscript, and flash, and I haven't found anything that seems to target this problem specifically.
If you've got any idea what's going wrong, please feel free to respond or show me how to better seek help on my own. Thanks again.
Symbol Source(strange)
Hi,
ive been using a freesource flash file and ive been adding my own items to the library by duplicating and editing the existing items in the library. I realise the original items are all exported into actionscript, first frame. Now this makes my preloader useless. So i disabled the first frame export and then the original items still work, but my own addons dont work anymore.
i found a slight inconsistency btw the original items and my duplicated items. i pasted the screenshots at
http://junde.howtofish.net/3248web/prt.htm
the original item is in the first pic, my duped and edited item in the second.
apparently, the original item has a symbol source while the new item doesnt. strange thing is, the source file pointed from in the symbol does not exist anywhere in my directory! All the original items point to that same source file.
so how can i add the symbol source file to my own items?
or how can i get my preloader to work?
this is rather urgent
Thanks!
foz
Strange Adding Problem
Scenario: I have an array and a variable, say x. I want to perform a function on a member of the array and its adjacent members:
Code:
doSomething(myArray[x]);
doSomething(myArray[x+1];
doSomething(myArray[x-1];
When I do this, however, the "x+1" is concentating rather than adding. For example, if x=5 and play the movie and trace x, x+1, and x-1. It shows that x=5, x-1=4, but x+1 is ending up as 51. Anybody seen this? Why might this be happening?
Thanks.
%2D Replaces '-'.. What Do I Do?
I'm trying to send a negative value to a text file using loadvars().
so i did this:
send_lv.xPos = currObj._x;
but if the _x is negative, the minus is replaced by '%2D'
How do i send the minus sign??
Strange Tween Issue
I have a class that has a Tween in it, but it seems that when the Tween finishes, it forgets the object that started the Tween and changes it to the last Tweened object. Hard to explain, but consider part of the code..
ActionScript Code:
function controlTweenFinish() {
trace("Finish:"+name);
}
function doTween()
{
var myTween:Tween = new Tween(mc, "_xscale", Bounce.easeOut, 100, 120, 5, false);
new Tween(mc, "_yscale", Bounce.easeOut, 100, 120, 5, false);
motionFinishedListener.onMotionFinished = Delegate.create(this, controlTweenFinish);
myTween.addListener(motionFinishedListener);
trace("Start:"+name);
}
The output to this is:
Code:
Start:buttonBack0
Finish:buttonBack0
So far so good, but if there are multiple objects that start a tween around the same time I get:
Code:
Start:buttonBack1
Start:buttonBack2
Finish:buttonBack2
Finish:buttonBack2
Why the hell is the controlTweenFinish() function acting like a static function? It seems to think that it's a global function or something, but it's not. I used Delegate to keep it in the scope of the current object. Can someone please explain what is going on, or better still help with a way to fix this?
Adding A Symbol To The Stage In AS3
I already have a timer event that will run the function cometMove every 5 seconds.
In the function cometMove I need to put the symbol comet (which I have in my library)on the stage.
I'm a little unclear about what to do next. Do I need to create a variable with the "new" function? If so, what class is a graphic symbol? GRAPHICS? Then how do I call the variable in the cometMove function?
Thanks for your help.
Centering Symbol While Tween. Please Help
Hey guys,
I am trying to horizontal flip a symbol , by tweening it.
My problem is, the symbol doesnt stay centered, so while it tweens, it doesnt exactly flip horizontaly. I'd appreciate any kind of help..
Thanks.
Motion Tween- No Symbol
how can i make a motion tween without converting the image to a symbol?
thanx for any help!
Strange Problem: Animation Tween
i am facing small strage problems
i know how to use animation tween
i ahve two layers
the first layer has flvplayback which loads flv
the above layer has square: in frame 1 alpha = 100m in frame 20 alpha = 0
so the flv apears gradually
the animation does not work
i copied the same frames to another fla file, it works
what is happening
i relaunched the flash, but still there
i restarted my PC, but still there
Thanks in advance
Tween.. Strange Behaviour When It's Finished.
Hello, did anyone expercienced this:
I have some buttons that initialize a tween effect, with an onRollover and an RollOut.
The rollOver is:
var TweenSubMenu:Tween = new Tween(currMovie, "_y", Strong.easeOut, 0, EindposY, 1, true);
and the Roll Out is:
var TweenSubMenu:Tween = new Tween(currMovie, "_y", Strong.easeOut, currMovie._y, 0, 2, true);
Now what is strange is that when the ween moves down (roll Over) that at the end of it's tween
is suddenly jumps to it's original _y position?
This only happens when you set the time for the rollout to 2 seconds. If you set it also to 1 second it works just fine.
Does anyone know what happens here?
Regards,
Micheal
AS 2 Strange Problem With Tween Class
I've made a flash that run perfectly in most clients but in some very few clients a problem occurs when its loaded the fist time, but when I refresh the webpage, it works just fine. Most part of the movie works just great, but there is some few movieclips that I fade in with the tween class, those clips doesn't load at the first time. Does anyone had the same problem using the tween class?
Strange Problem With Tween Class
I've made a flash that run perfectly in most clients but in some very few clients a problem occurs when its loaded the fist time, but when I refresh the webpage, it works just fine. Most part of the movie works just great, but there is some few movieclips that I fade in with the tween class, those clips doesn't load at the first time. Does anyone had the same problem using the tween class?
Symbol Swapping After A Motion Tween
hi, i have a problem with swaping symbols after i do a motion tween. after the tween is completeed on the next keyframe i end the tween so it does not carry through. but when i try to change the symbol in the next frame it just stays the same and if i delete it and try to put another symbol it trun it to the one i used in the tween.
please help,
thank you
Urgent Please Help -> Set Symbol Color And Tween
I got weird situation.
I want to move a circle from point A to point B.
I made a circle symbol.
In that symbol, I put this actionscript :
new Color(this).setRGB("0xff0000");
So I assumed the circle color will be changed to RED.
But, then it does not move !
Anyone know why ?
Here is the code :
http://www.angelfire.com/comics/kapot0/circle.fla
Please help me ....
Attachmovie Replaces Movieclips
hey, probably a really simple error, but here goes..
I am making a game, called manior impossible (a rip of mansion impossible, pretty much). In it, I need random spawning houses. So I have set up an array to keep track of where they are, and I have set out a random number to choose where it goes.
However, everytime it makes a house, it replaces the last one, and I have no idea why!
Here is the code:
Code:
//to make a house appear
function houseAppear() {
houseInt = setInterval(house, (random(15)+15)*500);
function house() {
//whichH = random(3)+1
whichH = 1;
switch (whichH){
case 1:
houseid = random(shouse.length);
if (shouse[houseid][2] == "1"){
trace("this spot is actually taken");
}else{
trace("small at "+shouse[houseid][0]+","+shouse[houseid][1]+" of ID mc_house"+houseid);
shouse[houseid][2] = "1";
attachMovie("mc_shouse", ("mc_shouse"+houseid), (this._x + this._y*450), {_x:shouse[houseid][0], _y:shouse[houseid][1]});
}
break;
case 2:
trace("m");
break;
case 3:
trace("l");
break;
}
}
}
as you can see, there will be 3 types of hosues, but I am just made it so that only one appears for now. I apologise for the horrible coding!
here is the fla if you need it too:
http://munkydesigns.co.uk/game.fla
cheers if anyone can shed some light on this!
Adding Different Actionscript To Multiple Instances From The Same Symbol
well thats it, kind of. i have a movie, inside that movie is a button, and a layer with animation that is activated with script when the button is moused over, with the use of the call action. i have about 10 instances of the movie on my scene, however i dont know how to add different actions to one instance without it affecting them all. i'm a bit of a beginner to actionscript, so i dont know what to do. i could upload the file if it might help. well, if anyone understands what i am trying to do, and knows how to do it...let me know, i could really use the help.
thanks, Ben
Adding Alpha To Hundreds Of Non Symbol Frames
hello, I have a problem which i can resolve (but only if i spend hundreds of hours) but want to know if there is a quick way of doing this.
I have a spinning 3d menu system (made with swift and textured manually by myself with 12 images to look as if it is attached to the 3d objects via masking) there are 120 frames, and 48 layers, so muliply the frames 120 X 24 (half of the layers are for masking) so you have an awful lot of frames.
I want to alphaize the images so that the further they get the more transparent they are, problem is that none of them are symbols, they are all instances of the jpg itself, If I make a symbol of them all I can manually alphaise each one but that (as mentioned) would take ages. and this also would cause multiple sybols which would be just plain messy.
Is there a way to make them all one symbol, (the instances of the jpg are rotated at variang angles throght the frams, and would wish to maintain that rotation angle / size etc.) so at least it wold not be messy. or is there some way i can acomplish this withouth spending an eternity? if so please help
I am not sure if i am making myself clear here, but for anyone who is intrested i can email you the FLA file so you will have a better understanding what i am talking about.
Help With Adding Hyperlink To Movie Clip Symbol
Hello,
i am rather new to flash and decided to start out with a template from the web, i cannot seem to figure out how to add links to a Movie Clip Symbol.
If anyone can give me detailed information to help get me through this it would be MUCH appreciated..
Contact info:
Bedpost@hotmail.com = MSN Messenger
or
DerZ@Team-GoG.com = Email
or of course ill keep checking here every 20 secs! hah
Thanks in Advance,
DerZy
Adding OnClick Event To Dublicated Symbol?
Hi I have some code which recieves some PHP variables load1, load2, load3 etc. and id1, id2, id3 etc. where loadx is an image name, and idx is an url. Now I want to make load1 go to id1 on mouseclick.
The following is my code:
posx = 1;
depth = 1;
for(i=1; i<10; i++){
var img:MovieClip = imageholder.duplicateMovieClip("image"+i, depth);
img._alpha = 0;
img._x = posx;
img._y = 4;
img.loadMovie(this["load"+i]);
posx = posx + 46; // i + 45 igen...
depth = depth + 1;
// create onrelease action for image 1 to 10 (i)
img.onRelease=function(){ getURL("myscrip.php?id="+this["id"+i], "_self"); }
// onpress onrelease
}
Why doesn't this work?
Mads
Adding A Trademark Symbol In Xml Flash Menu
Hi, I am a front end web designer/developer and analyst...struggling with putting an accordian flash xml menu together. I have it done except I need to add a simple trademark symbol circle with r. I am struggling with how to do this since I am not savvy in actioncript. I assume the best way is to add it is with a CDATA child node, but do not know how or whatever is the best way to get this done since am on a tight deadline. I need someone to explain step by step what I have to do to get this simple addition resolved. Attached are the links to home page and code for the xml file. The left navigation is the asset that I need to add the trademark symbol under about, about ADHERE. Thanks so much in advance!!!!!!
index page
Attach Code
<?xml version="1.0" encoding="UTF-8"?>
<accodion>
<item name="HOME">
</item>
<item name="ABOUT">
<item name= "ABOUT ADHERE<![CDATA[write]]>"></item>
<item name="Medical Information" url="http://www.jnj.com?ref=Random">
</item>
<item name="About SCIOS" url="http://www.jnj.com?ref=Random">
</item>
</item>
<item name="INTERACTIVE DOSING INFORMATION">
<item name="Indications and Usage" url="http://www.jnj.com?ref=Random"></item>
<item name="Contraindications" url="http://www.jnj.com?ref=Random"></item>
<item name="Warnings" url="http://www.jnj.com?ref=Random"></item>
<item name="Dosage and Administration" url="http://www.jnj.com?ref=Random"></item>
</item>
<item name="RESOURCES AND TOOLS">
<item name="NATRECOR PI" url="http://www.jnj.com?ref=Random"></item>
<item name="About Heart Failure" url="http://www.jnj.com?ref=Random"></item>
<item name="Stages of Heart Failure" url="http://www.jnj.com?ref=Random"></item>
<item name="NATRECOR Dosing Information" url="http://www.jnj.com?ref=Random"></item>
<item name="Patient Management Resources" url="http://www.jnj.com?ref=Random"></item>
</item>
<item name="US PRESCRIBING INFORMATION">
</item>
<item name="IMPORTANT SAFETY INFORMATION ref=http://www.jnj.com">
</item>
<item name="REGISTRATION ref=http://www.jnj.com">
</item>
</accodion>
Help With Adding Hyperlink To Movie Clip Symbol
Hello,
i am rather new to flash and decided to start out with a template from the web, i cannot seem to figure out how to add links to a Movie Clip Symbol.
If anyone can give me detailed information to help get me through this it would be MUCH appreciated..
Contact info:
Bedpost@hotmail.com = MSN Messenger
or
DerZ@Team-GoG.com = Email
Thanks in Advance,
DerZy
Can You Scale A Symbol In A Tween, But Keep The Line Thickness The Same?
Is there a way without using actionscript to increase the size of a symbol, but keep it's line thickness the same?
I'm trying to create a sonar or radar style effect where an empty circle tweens from small to large around a point, and fades out as it grows. I want the line thickness to remain the same though as it scales.
Thanks for any help!
Having Trouble Adding Action Script To Button Symbol
Hello everyone:
I am hoping someone will read this as I am a developer in 'dires straits' with Flash ( a newbie). My problem regards a layer called "button" which has already been converted to symbol and turned into an invisible button. The problem lies when I try to use the selection tool to select it so that I can add action script to it. Instead of the actions dialogue box saying "actions-button", it says "actions-frame", and as a result, the action script doesn't work. I don't know what to do, it should be simple to select it but something is wrong. If you feel a need to help a developer in need, you can email me at support@tahutiwebsites.com, and I can e-mail you the file so that you can help. Thanks, or you can call me at 310-867-5167
Corinna
Simple Question: Adding Actionscript To Symbol Definitions
Hi,
I'm fairly new to flash, but have been experimenting a lot with different ideas etc. I'm currently creating a swf that has 4 buttons, each one moves to a different page by sliding a content window across the page.
The problem I have is that the function only works when the script is placed inside the "symbol definition" within the actions pane. (rather than in the timeline or scene menu). And I can't get Flash to let me apply actions to symbol definitions - there is just no drop down list of definitions!
How can I add the actionscript to the symbol definition??
[CS3] X CS4 Flash Movie Clip Symbol Tween Not Working?
Hi guys, I'm making a website layout and in the background I want to have a length of code scroll up and down.
So I typed the code out into a text field and made it a movie clip symbol, and I went in and edited the clip so that on frame 30 it moves up to a certain height, and by frame 60 it moves back down into it's original location.
The problem I'm having is that when I right click between keyframes and click "Create motion tween", the frames between the keyframes turn the light greenish colour, but there is no arrow pointing from the first keyframe to the next...and when I run the clip, it sits at it's original location for the first 30 frames, then jumps up to it's position on frame 30, where it sits until it hits frame 60 and it jumps back down to where it was (no tween). Does anyone know what's wrong?
Load Text Into Dynamic MC - But Replaces Previous Mc
This is freaking me out...
I have a function which adds movieclips dynamically into another
movieclip. Inside the dynamic movieclip is a dynamic textbox
(it gets it's content from a textfile via the function).
However, if I add more than one movieclip, the previous added
mc's gets the textbox value undefined (doesn't matter if it's an
identical mc or a different one). And it hasn't got to do with levels,
I've already checked that...
Here's the function:
ActionScript Code:
addTxt = function (src, objWidth, xpos, ypos, level) { text_lv = new LoadVars(); text_lv.onLoad = function(success) { if (success) { clip_mc = _root.contentContainer_mc.content_mc.attachMovie("text_mc", "text"+level+"_mc", level); clip_mc._x = xpos; clip_mc._y = ypos; clip_mc.text_txt._width = objWidth; clip_mc.text_txt.html = true; clip_mc.text_txt.htmlText = text_lv.txt; clip_mc.text_txt._height = clip_mc.text_txt.textHeight; } }; text_lv.load("text/"+src);};
the function is called by an "XML-loop", and the level-var is changed for each mc that is to be created.
so how can this be???
I will be extremely happy if someone of you guys knows the solution to my problem!
Thank you very much in advance
Parent Swf Replaces Loaded Swf's _root ? A WorkAround
Hey guys, I got a preloader swf and inside this preloader swf i load another swf, site.swf.
inside site.swf, i have several references to _root.mc1.and so on.
once i load site.swf into the preloader.swf, all AS that referred to _root.mc1 seems to no longer work.
The way i'm loading site.swf into preloader.swf is using loadMovieClip command and i should note that im loading site.swf into a container MC.
now i know, well if u load site.swf into the container mc, that's why all the references in site.swf that say _root.mc1 no longer work because it's really _root.container.mc1 now.
im having trouble thinking of way of fixing this instead of going all through my site.swf and replacing _root with this._parent and etc.
any ideas? Is there a better way to load the swf into the preloader swf and keep my code untouched?
Load Text Into Dynamic MC - But Replaces Previous Mc
This is freaking me out...
I have a function which adds movieclips dynamically into another
movieclip. Inside the dynamic movieclip is a dynamic textbox
(it gets it's content from a textfile via the function).
However, if I add more than one movieclip, the previous added
mc's gets the textbox value undefined (doesn't matter if it's an
identical mc or a different one). And it hasn't got to do with levels,
I've already checked that...
Here's the function:
ActionScript Code:
addTxt = function (src, objWidth, xpos, ypos, level) { text_lv = new LoadVars(); text_lv.onLoad = function(success) { if (success) { clip_mc = _root.contentContainer_mc.content_mc.attachMovie("text_mc", "text"+level+"_mc", level); clip_mc._x = xpos; clip_mc._y = ypos; clip_mc.text_txt._width = objWidth; clip_mc.text_txt.html = true; clip_mc.text_txt.htmlText = text_lv.txt; clip_mc.text_txt._height = clip_mc.text_txt.textHeight; } }; text_lv.load("text/"+src);};
the function is called by an "XML-loop", and the level-var is changed for each mc that is to be created.
so how can this be???
I will be extremely happy if someone of you guys knows the solution to my problem!
Thank you very much in advance
Adding _x And _y To A Tween Function
I have the function below that moves portTxtHolder to a position, it is called using:
_root.PTpos1();
function PTpos1()
{
extendTween = new TweenExtended(portTxtHolder,["_x","_y"],
easingType,[portTxtHolder._x,portTxtHolder._y],[600,505],2,true);
}
what i want to do is add or subtract from this start position to save me writing extra functions for each new postion,
to add extra _x value like:
_root.PTpos1()_x+100;
to add 100 to the portTxtHolder, the above eg does not work but i 'm not sure what to do?
Help Adding Tween Class To MovieClipLoader
I'm trying to create a portfolio of images that fade in and fade out when you push either individual buttons or arrow keys. Essentially I am trying to recreate the following wesite www.douglasadesko.com. This website was created with components and a lot of actionscript that I don't understand. I need to be able to update this site on a regular basis, so I've attempted to recreate it without components so that I can access the information easily. I have created a MovieClipLoader and set up separate folders for the images ("portfolio 1", "portfolio 2", etc). I have also found a script that will make anything ON THE STAGE fade in/fade out, but I am having trouble applying it to the existing actionscript for the MovieClipLoader. The following is the script which loads the images from the separate folders:
bar._visible = false;
var empty = this.createEmptyMovieClip("container", "100");
empty._x = 24;
empty._y = 31;
my_mc = new MovieClipLoader();
preload = new Object();
my_mc.addListener(preload);
preload.onLoadStart = function(targetMC) {
trace("started loading "+targetMC);
container._visible = false;
bar._visible = true;
pText._visible = true;
};
preload.onLoadProgress = function(targetMC, lBytes, tBytes) {
bar._width = (lBytes/tBytes)*100;
pText.text = "% "+Math.round((lBytes/tBytes)*100);
};
preload.onLoadComplete = function(targetMC) {
container._visible = true;
bar._visible = false;
pText._visible = false;
trace(targetMC+" finished");
};
//default image
my_mc.loadClip("portfolio 1/1.jpg", "container");
//buttons
button1.onPress = function() {
my_mc.loadClip("portfolio 1/1.jpg", "container");
};
button2.onPress = function() {
my_mc.loadClip("portfolio 1/2.jpg", "container");
};
button3.onPress = function() {
my_mc.loadClip("portfolio 1/3.jpg", "container");
};
button4.onPress = function() {
my_mc.loadClip("portfolio 1/4.jpg", "container");
};
button5.onPress = function() {
my_mc.loadClip("portfolio 1/5.jpg", "container");
};
button6.onPress = function() {
my_mc.loadClip("portfolio 1/6.jpg", "container");
};
button7.onPress = function() {
my_mc.loadClip("portfolio 1/7.jpg", "container");
};
button8.onPress = function() {
my_mc.loadClip("portfolio 1/8.jpg", "container");
};
button9.onPress = function() {
my_mc.loadClip("portfolio 1/9.jpg", "container");
};
button10.onPress = function() {
my_mc.loadClip("portfolio 1/10.jpg", "container");
};
button11.onPress = function() {
my_mc.loadClip("portfolio 1/11.jpg", "container");
};
button12.onPress = function() {
my_mc.loadClip("portfolio 1/12.jpg", "container");
};
button13.onPress = function() {
my_mc.loadClip("portfolio 1/13.jpg", "container");
};
button14.onPress = function() {
my_mc.loadClip("portfolio 1/14.jpg", "container");
};
button15.onPress = function() {
my_mc.loadClip("portfolio 1/15.jpg", "container");
};
button16.onPress = function() {
my_mc.loadClip("portfolio 1/16.jpg", "container");
};
button17.onPress = function() {
my_mc.loadClip("portfolio 1/17.jpg", "container");
};
stop();
The script for the Tween class is :
import mx.transitions.Tween;
import mx.transitions.easing.*;
new Tween(fade_mc, "_alpha", Strong.easeIn, 100, 0, 3, true);
Please let me know how to combine the two of these commands or if I need a different script. Another problem that I'm having is that once the images are loaded, they do not leave the screen when the scene changes. Please let me know where to insert an unload command and what that might be. I only know very basic Flash, so if you could be as specific as possible when explaining how to accomplish this I would really appreciate it.
Thanks!
Adding Ease To A Scripted Tween
how do i add an ease to this code:
Code:
new mx.transitions.Tween(logo_mc, "_y", mx.transitions.easing.Regular.easeOut, 500, 306, 2, true);
the 500 and 306 are for the y-pos. and the 2 is the speed.
thank you.
Adding A Tween To Dynamically Loaded Movie
To start, I would just like to say that I’m new to flash... I did use it back in flash 4 but never was very good at it.
This is the situation, I've used action script to create a movie, and then place a picture in this movie the code is as follows:
MovieClip.prototype.loadjpg = function(picName, holderName) {
var h = holderName==undefined ? "holder" : holderName;
this.createEmptyMovieClip(h, 1);
this._visible = false;
this[h].loadMovie(picName);
var id = setInterval(function (mc) {
if (mc[h]._width > 0) {
mc._alpha = 99;
clearInterval(id);
mc._visible = true;
mc.onComplete();
} else {
mc.onLoading();
}
}, 80, this);
};
function positionIt() {
this._x = 0;
this._y = 0;
}
this.createEmptyMovieClip("myjpg", 1);
myjpg.onComplete = positionIt;
myjpg.loadjpg("main.jpg");
stop();
Is it possible to animate this created movie in a tween? The effect I want is to have a generic fla for each section of the site that all that needs to be changed is the location of the background image. Each with the same animation, however some sections have other stuff that has to be loaded and I don’t want them to be loaded each time.
Adding Link To A Button Inside Of A Tween...
I tried to do a search for the answer, but that option isn't working right now.
I'm working in MX Pro and I need a way to add a link to a button, but the button is already a part of a tween. I tried to edit the button form the library, but it wouldn't allow me to add any actionScripts. Can anyone help me???
[MX04] Penner Tween-- Adding A Pause?
I'm attempting to learn the ins and outs of actionscripting animation using penner tweens.
I'm having a difficult time understanding how to add a pause (or rather no motion) to an existing movie clip BEFORE it goes into another tween.
import mx.transitions.Tween;
import mx.transitions.easing.*;
var ball_tween:Object = new Tween(ball_mc, "_x", Bounce.easeOut, ball_mc._x, 300, 6, true);
ball_tween.onMotionFinished = function() {
ball_tween.continueTo(56, 3);
};
I'd like to add some time between the point where the ball_mc goes into the onMotionFinished function, and just learn how to deal with adding time in general when everything is being scripted on one frame. Is it possible to have several actionscripted keyframes with different variables that set off at various times? any input is GREATLY appreciated!
Augh!
Any ideas?
Adding Easing Tween -- To Exisiting Function
Adding Easing Tween -- to exisiting function
Ok so I found this nice code over at Prototype. Its a function for Aligning to stage on Resize. http://proto.layer51.com/d.aspx?f=1514
It works really nice on its own but I was hoping to add some tweened easing as an additional optional parameter. (I posted there twice asking for help to no avail =( So I am asking here at Kirupa, hoping someone can help me with my struggles. What I wish to add is - implementing and adding an "easing" function as part of the current function. Something generalized to be called only if desired and the ability to set the ease type, duration, maybe prop etc.. (or whatever needed to make it work )
I have tried all kinds of things and below is as close as I can come (at least the only thing I can do to get the thing to move, although as you will see it works backwards and I can only get it to work using stage.width, stage.height, however I have tried newX oldX and all kinds of other things and cant seem to get things to move.
I am missing something, perhaps everything
Code:
// Original Script found here --
// Functions: Align to stage on Resize -- http://proto.layer51.com/d.aspx?f=1514
// +++ Stage Align +++
// onR function is used with fullscreen & "T(op)L(eft)" Stage.align as a ref point!!!
//fscommand( "fullscreen", true ); // <<-- Optional if needed
import mx.transitions.Tween;
import mx.transitions.easing.*;
Stage.scaleMode = "noScale";
Stage.align = "TL";
// Optional Easing -- I am trying to add with no success =(
function mover(obj:MovieClip, startX:Number, startY:Number, endX:Number, endY:Number) {
var tweenX:Tween = new Tween(obj, "_x", Regular.easeInOut, startX, endX, 1, true);
var tweenY:Tween = new Tween(obj, "_y", Regular.easeInOut, startY, endY, 1, true);
}
// trigger alignment via Stage listener object!
// alignment options: "TL", "TR", "TC", "BL", "BR", "BC", "CL", "CR", "CC"
// optional offset by X or Y axis provided as an object property: obj.X, obj.Y
function onR(A, obj) {
var F = String(A).substring(0, 1);
var L = String(A).substring(1, 2);
(obj.X == undefined) ? obj.X=0 : obj.X=obj.X;
(obj.Y == undefined) ? obj.Y=0 : obj.Y=obj.Y;
if (F == "T") {
obj._y = Math.ceil(obj.Y);
} else if (F == "B") {
obj._y = Math.ceil(Stage.height-obj._height-obj.Y);
} else if (F == "C") {
obj._y = Math.ceil((Stage.height-obj._height)/2-obj.Y);
}
if (L == "L") {
obj._x = Math.ceil(obj.X);
} else if (L == "R") {
obj._x = Math.ceil(Stage.width-obj._width-obj.X);
} else if (L == "C") {
obj._x = Math.ceil((Stage.width-obj._width)/2-obj.X);
}
}
//Usage
// ... later
// -- OPTIONAL positioning - to add further positioning of items if needed
mc_1.X = 100;
// X offset for mc_1 used for Center Left alignment
mc_2.Y = -50;
// Y offset for mc_2 used for Center Right alignment
var resizeListener:Object = new Object();
resizeListener.onResize = function() {
onR("CL", mc_1);
onR("CR", mc_2);
// Optional Easing Call to mover function -- I am trying to add with no success =(
// I know its set to stage center now but with all my efforts, this is the only senerio
// I can get anything to move, I tried newX old X etc.. this. and on and on.. can
// someone be so kind to help me add an "optional" workable easing function to this
// script? Mucho Apreciato to anyone that does ;-)
mover(mc_1, mc_1._x, mc_1._y, Math.round(Stage.width/2), Math.round(Stage.height/2));
mover(mc_2, mc_2._x, mc_2._y, Math.round(Stage.width/2), Math.round(Stage.height/2));
};
Stage.addListener(resizeListener);
// also the 2 mcs have registration in upper left etc..
I am open to suggestions on implementation, I just thought this function from prototype was pretty slick really and wanted to add some easing to it. It should be possible, I just cant get my head wrapped around it.
Can anyone please provide some help? I really appreciate your input people Thanks for your help.
__________
Simplify What I am asking:
http://proto.layer51.com/d.aspx?f=1514
Add easing to the above function found at that link (also posted above) on browser resize, so any MCs using the align function ease to there new location instead of just snapping into place.
Thanks everyone
Adding Easing Tween -- To Exisiting Function
Adding Easing Tween -- to exisiting function
Ok so I found this nice code over at Prototype. Its a function for Aligning to stage on Resize.
http://proto.layer51.com/d.aspx?f=1514
It works really nice on its own but I was hoping to add some tweened easing as an additional optional parameter. (I posted there twice asking for help to no avail =( So I am asking here at GTAL, hoping someone can help me with my struggles. What I wish to add is - implementing and adding an "easing" function as part of the current function. Something generalized to be called only if desired and the ability to set the ease type, duration, maybe prop etc.. (or whatever needed to make it work :( )
I have tried all kinds of things and below is as close as I can come (at least the only thing I can do to get the thing to move, although as you will see it works backwards and I can only get it to work using stage.width, stage.height, however I have tried newX oldX and all kinds of other things and cant seem to get things to move.
I am missing something, perhaps everything :D
Code:
// Original Script found here --
// Functions: Align to stage on Resize -- http://proto.layer51.com/d.aspx?f=1514
// +++ Stage Align +++
// onR function is used with fullscreen & "T(op)L(eft)" Stage.align as a ref point!!!
//fscommand( "fullscreen", true ); // <<-- Optional if needed
import mx.transitions.Tween;
import mx.transitions.easing.*;
Stage.scaleMode = "noScale";
Stage.align = "TL";
// Optional Easing -- I am trying to add with no success =(
function mover(obj:MovieClip, startX:Number, startY:Number, endX:Number, endY:Number) {
var tweenX:Tween = new Tween(obj, "_x", Regular.easeInOut, startX, endX, 1, true);
var tweenY:Tween = new Tween(obj, "_y", Regular.easeInOut, startY, endY, 1, true);
}
// trigger alignment via Stage listener object!
// alignment options: "TL", "TR", "TC", "BL", "BR", "BC", "CL", "CR", "CC"
// optional offset by X or Y axis provided as an object property: obj.X, obj.Y
function onR(A, obj) {
var F = String(A).substring(0, 1);
var L = String(A).substring(1, 2);
(obj.X == undefined) ? obj.X=0 : obj.X=obj.X;
(obj.Y == undefined) ? obj.Y=0 : obj.Y=obj.Y;
if (F == "T") {
obj._y = Math.ceil(obj.Y);
} else if (F == "B") {
obj._y = Math.ceil(Stage.height-obj._height-obj.Y);
} else if (F == "C") {
obj._y = Math.ceil((Stage.height-obj._height)/2-obj.Y);
}
if (L == "L") {
obj._x = Math.ceil(obj.X);
} else if (L == "R") {
obj._x = Math.ceil(Stage.width-obj._width-obj.X);
} else if (L == "C") {
obj._x = Math.ceil((Stage.width-obj._width)/2-obj.X);
}
}
//Usage
// ... later
// -- OPTIONAL positioning - to add further positioning of items if needed
mc_1.X = 100;
// X offset for mc_1 used for Center Left alignment
mc_2.Y = -50;
// Y offset for mc_2 used for Center Right alignment
var resizeListener:Object = new Object();
resizeListener.onResize = function() {
onR("CL", mc_1);
onR("CR", mc_2);
// Optional Easing Call to mover function -- I am trying to add with no success =(
// I know its set to stage center now but with all my efforts, this is the only senerio
// I can get anything to move, I tried newX old X etc.. this. and on and on.. can
// someone be so kind to help me add an "optional" workable easing function to this
// script? Mucho Apreciato to anyone that does ;-)
mover(mc_1, mc_1._x, mc_1._y, Math.round(Stage.width/2), Math.round(Stage.height/2));
mover(mc_2, mc_2._x, mc_2._y, Math.round(Stage.width/2), Math.round(Stage.height/2));
};
Stage.addListener(resizeListener);
// also the mcs have reg in upper left etc...
I am open to suggestions on implementation, I just thought this function from prototype was pretty slick really and wanted to add some easing to it. It should be possible, I just cant get my head wrapped around it. :?
Can anyone please provide some help? I really appreciate your input people Thanks for your help :)
Begginer: Adding Tween Motion To A Group Of Layers
Hi, I'm newbie in flash, currently I'm using flash cs3 at work and flash 8 at home, my problem is this:
I'm trying to add a tween motion effect to several layers, each layer has an one single instance of a symbol, this symbol is a movie clip type, then, those layers have a keyframe inserted (from 1 to 12), then in the frame 1 I modified some characteristics of the instance, such as height, width and color, then, I shift selected the frame 1 of all layers and from the properties panel I've chosen motion from tween drop down menu, but when I played the animation nothing happens, there's no effect. I don't know what I'm doing wrong.
Also when I closed this file and then I want to open it, I can see just one layer (not five), the instances are still there but I cant see each layer, why is this?
Regards
Adding Motion Tween To Fade Effect Causes Text To Jump
I'm trying to put a motion tween on a graphic to make it fade out. However, every time I put a motion tween on it, in the frame after the first keyframe (where the tween is applied), the graphic jumps down about a pixel or two. This happens every time I try to do a motion tween on this particular graphic. I have a cuople of other graphics on the page doing the same thing, and they stay in the same position throughout the tween.
Adding Actionscript To A Tween To Make A Motion SMOOTH Without Using Ease In Propert.
I want to know how people make there tweens soooo smooth
i play around with the ease in the properties panel.. and it helps but the effect is not as seemless as other effects i have seen.
i have come across a script that will make a smooth tween with only actionscript...but my negitive comments against that is...i like to see the actual tween and put it where i want. I don't want to mess with code and the x and y axises to put it where i want by trail and error putting in different types of x or y axises to put the shape that is being tweened in the correct spot. if i could only add some script to the tween i already have made it would make the process ALLOT BETTER ?
fellow flash kiters, is there an answer ?
Tween Class, Does It Use Setinterval? Getting Strange Setinterval Type Problem
I have a gallery with small thumbnails. Upon clicking a thumbnail, I am using the Tween class to pull clips from an array and fade them between each other, loading the clips into a container.
When I click the thumbnail it loads the .swf fine and plays the Tween Class animation just as it's supposed to, however if I click any other thumbnail and go back to that first one the timing gets totally screwed up and the fades get jittery and overlap each other, much like it does with setInterval if you don't clear the intervals.
Is there a way to clear the Tween Class? Does it's timer run on setInterval?
This is the code I am using for the tween class
Thanks!
Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
//content movieclips put into an array
var mcArray:Array = new Array(content1, content2);
for (var k in mcArray) {
mcArray[k]._alpha = 0;
}
// tween class has something called "OnEnterFrameBeacon" and it is added to the stage
// when we import the as file, so I wanted to get rid of it.
var n:Number = 0;
function playFades() {
if (n<mcArray.length) {
var tween_handler1:Object = new Tween(mcArray[n], "_alpha", Strong.easeIn, 0, 100, 1, true);
tween_handler1.onMotionFinished = function() {
//trace("motion finished by "+mcArray[n]);
//n++;
var tween_handler2:Object = new Tween(mcArray[n], "_alpha", Strong.easeIn, 100, 0, 3.5, true);
tween_handler2.onMotionFinished = function() {
//trace("motion finished by "+mcArray[n]);
n++;
playFades();
};
};
} else {
n = 0;
playFades();
}
}
playFades();
Strange "noise" On Tween
I've never had this happen to me before, it's a simple scripted _x tween, but it leaves a little 'trail' of some orange color, which is not used anywhere in the app. Thoughts? View Pic Here
Uploaded File Replaces Previously Uploaded
Having trouble with FileReference, am trying to have several buttons which call the same fileReference functions and create/attach uploaded image to movie clips made at runtime.
At the moment, am testing with 2 buttons which are loading images and renaming correctly, but only one at a time. When I click on the other button, the previously loaded image/movieclip is dissappearing.
I have a feeling, it's some small silly thing not to do with the fileReference, but a targeting error...
Any help would be greatly appreciated. Code attached below(not tidiest code, sorry!):
Code:
System.security.allowDomain("http://192.168.1.42/");
//Import FUSE engOute
import com.mosesSupposes.fuse.*;
ZigoEngine.simpleSetup(Shortcuts,PennerEasing,FuseFMP);
import flash.net.FileReference;
mug_bk.setMask(mug_mask);
/*--------------global / intial variables----------------------------*/
_global.textNumber=0;
_global.activeText="_root.newText1";
_global.imageFor="photo"
newDate = new Date();
var uploadImageCounter = newDate.getFullYear()+newDate.getMinutes();
/*-------haike functions start-------*/
haike_mask.cacheAsBitmap;
haike_select.onRelease=function(){
trace("step1");
uploadImage3();
}
/*-------haike functions end-------*/
/*---------photo functions start---------------------*/
photo_mask1.cacheAsBitmap;
photo_box1.onRelease=function(){
trace("step1");
uploadImage4();
}
/*---------photo functions end---------------------*/
/*-------frame functions start-------*/
/*-------frame functions end-------*/
/*--- RAKUGAKI STUFF --- */
/* -----------------------start stamp function ----------------------------------------------------
/*-----------------------end stamp function ---------------------------------------------------- */
/*------- start printing functions ----------------------*/
/*------- end printing functions ----------------------*/
/*---------start upload functions-------------*/
var uploadedImageType=""
var storedImagesPath="http://192.168.1.42/images/";
var targetMovieSize=100;
uploadBtn.label = "Upload Image";
/* The listener object listens for FileReference events. */
var listener:Object = new Object();
/* When the user selects a file, the onSelect() method is called, and passed a reference to the FileReference object. */
listener.onSelect = function(selectedFile:FileReference):Void {
trace("step3");
uploadImageCounter = random(newDate.getFullYear()+newDate.getMinutes());
var uploadPhpPath="http://192.168.1.42/upload.php?flashFileName="+_global.imageFor+uploadImageCounter+uploadedImageType;
/* Update the TextArea to notify the user that Flash is attempting to upload the image. */
statusArea.text += "Attempting to upload " + selectedFile.name + "
";
/* Upload the file to the PHP script on the server. */
selectedFile.upload(uploadPhpPath);
uploadedImageType=selectedFile.type;
uploadedImageType = uploadedImageType.toLowerCase();
};
listener.onOpen = function(selectedFile:FileReference):Void {
trace("step4");
statusArea.text += "Opening " + selectedFile.name + "
";
};
listener.onProgress = function(selectedFile:MovieClip,numBytesLoaded:Number,numBytesTotal:Number):Void {
trace("step5");
var pctLoaded:Number =Math.ceil(100*(numBytesLoaded/numBytesTotal));
statusArea.text += pctLoaded + "
";
Mouse.hide();
// This will get you the percent amount loaded for use in a preloader, etc...
};
/* When the file has uploaded, the onComplete() method is called. */
listener.onComplete = function(selectedFile:FileReference):Void {
trace("step6");
Mouse.show();
/* Notify the user that Flash is starting to download the image. */
statusArea.text += "Downloading " + selectedFile.name + " to player
";
/* Add the image to the ComboBox component. */
imagesCb.addItem(selectedFile.name);
/* Set the selected index of the ComboBox to that of the most recently added image. */
imagesCb.selectedIndex = imagesCb.length - 1;
/* Call the custom downloadImage() function. */
downloadImage();
};
var imageFile:FileReference = new FileReference();
imageFile.addListener(listener);
imagePane.addEventListener("complete", imageDownloaded);
imagesCb.addEventListener("change", downloadImage);
uploadBtn.addEventListener("click", uploadImage);
uploadBtn2.addEventListener("click", uploadImage2);
/* If the image does not download, the event object's total property will equal -1. In that case, display a message to the user. */
function imageDownloaded(event:Object):Void {
if (event.total == -1) {
trace("error");
}
}
/* When the user selects an image from the ComboBox, or when the downloadImage() function is called directly from the listener.onComplete() method, the downloadImage() function sets the contentPath of the ScrollPane in order to start downloading the image to the player. */
function downloadImage(event:Object):Void {
trace("step7");
_root.attachMovie("container",_global.imageFor,getNextHighestDepth,{_x:0, _y:0});
_root[_global.imageFor].attachMovie("container2",_global.imageFor,getNextHighestDepth,{_x:0, _y:0});
loadMovie(storedImagesPath+_global.imageFor+uploadImageCounter+uploadedImageType+"?="+random(uploadImageCounter), _root[_global.imageFor][_global.imageFor]);
_root[_global.imageFor]._alpha=0;
//delay before actions
delayClipManip=function(){
trace("step9");
_root[_global.imageFor][_global.imageFor].cacheAsBitmap;
var scalePercentage=100;
/*-------------------------------------------------------------------------------------------------------------------------*/
//RESIZE FUNCTIONS
/*-------------------------------------------------------------------------------------------------------------------------*/
_root[_global.imageFor].fadeIn(1);
switch(targetMovieSize){
case 89:
trace("89"+_root[_global.imageFor]);
_root[_global.imageFor].slideTo(75.3,387,1);
//duplicate this movie and add a copy to the haike button
break;
case 77.8:
trace("77.8"+_root[_global.imageFor]);
_root[_global.imageFor].slideTo(182,397,1);
//duplicate this movie and add a copy to the haike button
break;
}
maskClip=function(){
//add switch to set new mask for clip
//_root[_global.imageFor].setMask(_global.imageFor+"_mask");
}
//scale to target size
_root[_global.imageFor].scaleTo(scalePercentage,1,"linear",0,maskClip);
_root[_global.imageFor].onPress=function(){
_root[_global.imageFor].startDrag();
}
_root[_global.imageFor].onRelease=function(){
_root[_global.imageFor].stopDrag(this);
}
_root[_global.imageFor].onReleaseOutside=function(){
_root[_global.imageFor].stopDrag(this);
_root[_global.imageFor]._x=200;
_root[_global.imageFor]._y=200;
}
}
trace("step8");
_root.rotateTo(0,.1,"linear",0,delayClipManip);
}
function uploadImage(event:Object):Void {
targetMovieSize=100;
imageFile.browse([{description: "Image Files", extension: "*.jpg;*.jpeg;*.gif;*.png"}]);
}
function uploadImage2(event:Object):Void {
targetMovieSize=200;
imageFile.browse([{description: "Image Files", extension: "*.jpg;*.jpeg;*.gif;*.png"}]);
}
//haike
function uploadImage3(event:Object):Void {
trace("step2");
_global.imageFor="haike"
targetMovieSize=89;
imageFile.browse([{description: "Image Files", extension: "*.jpg;*.jpeg;*.gif;*.png"}]);
}
//photo01
function uploadImage4(event:Object):Void {
trace("step2");
_global.imageFor="photo"
targetMovieSize=77.8;
imageFile.browse([{description: "Image Files", extension: "*.jpg;*.jpeg;*.gif;*.png"}]);
}
/*----end upload functions-------*/
Motion Tween (fade) Text Converted To Symbol No "motion"
I am using flash mx and my file includes text that is supposed to fade in and out.
I do exactly as I do with images - alpha 0 fades into 100 % etc, and it looks fine on the stage, but when I publish the text simply pops on and off with no recognition of the alpha channel fading in and out.
I create the text as static text - old english font - and then I convert it to a symbol. I tween the symbol from 0 to 100 alpha and back again. Presumably making it a symbol essentially makes it an image, right? no?
I am relatively new to flash so I may be missing something obvious?
(yes I have checked out places like flashkit.com, but not exactly what I am looking for, want more control.)
Convert Graphic Symbol To Button Symbol
Howdy,
I have a graphic symbol on stage. I then create a button symbol from the graphic symbol and the registration point jumps up a tad? Why would the registration point move?
Thanks,
mperla
SYMBOL NAME PROBLEMS In SYMBOL PROPERTIES PANEL
hey,
i'm tring to go thru a tutorial for scripting a scrollbar to a movie clip. please take a look at the attached file: container_4.fla
i can't get the btm rt scroll bar to move the movie clip (title list), and i've checked all of my work vs. the tutorial and they seem to jive.
except...
when i inspect the "scroll_target" symbol thru the library, i notice that the symbol name in the top field (Name: scroll_target) is not the same as in the bottom Source/File section (Symbol Name: Symbol 10).
what gives? when i check the tutorial file (which works...) all the symbol names jive in both areas. now i'm wondering if there is a corruption in my app (Flash MX v.6.0) that is mis-assigning symbol names at a code level.
please help.
thanx.
b
Class To Generate New Symbol From Base Symbol
I've searched but can't find a reference to what I need. I'll try to explain the best I can. I have a single symbol that is a "gear tooth" which is in the library and exported for Actionscript with the identifier name "geartooth." I'm trying to create a Class called "gear" which accepts the following parameters: numGears as Number and gearTooth as movieclip. The purpose of the class is to dynamically create a gear based on the geartooth symbol and the number of teeth requested. The class has methods to determine the radius of the gear, to duplicate the original geartooth, and then to rotate each new geartooth instance the requisite angle around the calculated center to create a seamless gear. I want there to be a getter method to return this new gear as a single symbol that can be manipulated as such. Is this possible? If so can someone point me to some relevant examples of similar code? Thanks much.
|