Motion Tween Doesn't Work Inside Function
I made a motion tween that works great on it's own, but won't tween at all inside of a frame. Why not?
Here is the code as a function. What's up?:
Code: import mx.transitions.Tween; import mx.transitions.easing.*;
fadeIn(myMC);
fadeIn = function(mc) { var myHoriTween:Tween = new Tween (mc,"_x",Back.easeOut,900,0,1.1,true); }
FlashKit > Flash Help > Flash ActionScript
Posted on: 07-10-2008, 02:40 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Motion Tween Doesn't Work Inside Function
I made a motion tween that works great on it's own, but won't tween at all inside of a frame. Why not?
Here is the code as a function. What's up?:
Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
fadeIn(myMC);
fadeIn = function(mc) {
var myHoriTween:Tween = new Tween (mc,"_x",Back.easeOut,900,0,1.1,true);
}
Motion Tween Previews But Doesn't Work In .swf
I am trying to do a very simple motion tween with a letter of text but it is going blank in the test movie.
I created a symbol of the letter "T" and then made a simple motion tween of the T falling down. This works absolutely fine until I rotate the second of the keyframes. As soon as I rotate the second instance of the "T" it will scrub just fine but it wont work in the "test movie" mode or after it's published. I am using a motion tween with Sync, Snap, and auto rotate on. I tried the EXACT same methods on another symbol and it works just fine. Is there something special about Text symbols?
Please Help!
Thanks,
-Evan Worley
aka TheCypheR
[F8] Motion Tween Doesn't Work Correctly
Hi,
I've produced animations with motion tweens but for some reason my simple shape I've put in a movie clip refuses to move as a tween.
Your recommendations will be greatly appreciated.
Thank you,
Nancy
MX:AS1: Function Doesn't Work Inside Loop
My maskImage functions will not trigger from inside of my loop function. If I place the tasks outside of the function it works but agian still not inside the loop. What am I doing wrong. Here is my code.
Attach Code
///////////////////////////////////
// --------- Variables -----------
///////////////////////////////////
var xPos = 0;
var INITIAL_XPOS = xPos;
var MAX_X = 572;
var yPos:Number = 0;
var i:Number = 0;
var j:Number = 0;
var ticker:Number;
var time:Number = 500;
///////////////////////////////////
// ------------ Loop --------------
///////////////////////////////////
init();
///////////////////////////////////
// ------- Setup Init() -----------
///////////////////////////////////
function init() {
ticker = setInterval(tick, 2000, this);
}
///////////////////////////////////
// -------- Image Loop ------------
///////////////////////////////////
function tick(MC) {
if ((++MC.j) == 1) {
_root.maskImage1();
trace("1");
} else if (MC.j == 2) {
_root.maskImage[j]();
trace("2");
} else if (MC.j == 3) {
_root.maskImage[j]();
trace("3");
} else if (MC.j == 4) {
_root.maskImage[j]();
trace("4");
} else if (MC.j == 5) {
j = 0;
//clearInterval(MC.ticker);
}
}
///////////////////////////////////
// ------ Tiling Function ---------
///////////////////////////////////
tileMe = function () {
if (i<150) {
holder1.attachMovie("square", "new"+i, i, {_x:xPos, _y:yPos});
xPos += 52;
// check if xPos ever gets greater than MAX_X then move to the next row
if (xPos>MAX_X) {
xPos = INITIAL_XPOS;
// increase the y postion each time
yPos += 52;
}
i++;
} else {
clearInterval(tileIt);
}
};
var tileIt = setInterval(tileMe, 5);
///////////////////////////////////
// --- Masked Image Function ------
///////////////////////////////////
// --------------------------------
// this works outside the function
/*
_root.createEmptyMovieClip("holder1", this.swapDepths(_root.x));
_root.attachMovie("image1", "image1_mc", 1);
_root.image1_mc.setMask(holder1);
_root.x += 2;
tileMe();
*/
// --------------------------------
///////////////////////////////////
function maskImage1() {
_root.x += 2;
_root.createEmptyMovieClip("holder1", this.swapDepths(_root.x));
_root.attachMovie("image1", "image1_mc", 1);
_root.image1_mc.setMask(holder1);
tileMe();
}
/*
////////////////////////////////////
function maskImage2() {
_root.x += 2;
_root.createEmptyMovieClip("holder2", this.swapDepths(_root.x));
_root.attachMovie("image2", "image2_mc", 1);
_root.image2_mc.setMask(holder2);
_root.x += 2;
tileMe();
}
////////////////////////////////////
function maskImage3() {
_root.x += 2;
_root.createEmptyMovieClip("holder3", this.swapDepths(_root.x));
_root.attachMovie("image3", "image3_mc", 1);
_root.image3_mc.setMask(holder3);
_root.x += 2;
tileMe();
}
////////////////////////////////////
function maskImage4() {
_root.x += 2;
_root.createEmptyMovieClip("holder4", this.swapDepths(_root.x));
_root.attachMovie("image4", "image4_mc", 1);
_root.image4_mc.setMask(holder4);
_root.x += 2;
tileMe();
}
*/
Edited: 02/05/2007 at 01:40:49 PM by breez11
Button Inside Movie Clip Inside Scrollpane Doesn't Work In Xml
This is sorta odd but I'm hoping somewhat easy to fix. This is in AS2 and is the last problem I have in a very small project of mine.
I have button called button01 inside a movieclip called movieclip01 which is the contentPath for a scrollpane called scrollpane01. I'd like the button to work, and depending on the code it will work in the normal .swf but won't when I embed my movie into xml.
If I put the code inside movieclip01
button01.onRelease=function(){
_root.gotoAndPlay("Frame Name");
}
It will work when I test it but not in the XML. So what I want to do is go to the main timeline where the scrollpane is and write the code there. That is where I'm stuck.
I've tried scrollpane01.movieclip01.button01 and tried movieclip01.button01 and also tried scrollpane01.button01. Just for giggles I also tried scrollpane01.movieclip01 but none of that works
Last night I had a similar problem with buttons inside a movieclip that was on the root stage. They worked in the swf but not when I embedded the file - so I found this which worked (typed in the root stage)
movieclip01.button01.onRelease=function(){
Preloader Doesnt Work With Motion Tween ?
I've added a little example of a modified file of flashkit as it resembles my problem on a smaller scale. After the preloader my tweens don't work. it's just stuck. do I need to put 'play(1)' or something in the first frame of the first scene following the preloader ?
Yoyo() To Repeat A Tween Doesn't Seem To Work
Very easy one would say
Code:
var bl:BlurFilter = new BlurFilter(55,55,3);
circle_mc.filters = [bl];
circle_mc.onEnterFrame = pulse;
function pulse() {
var yTween:Tween = new Tween(this, "_height", mx.transitions.easing.Strong.easeOut, this._height, 200, 1, true);
//var xTween:Tween = new Tween(this, "_width", mx.transitions.easing.Strong.easeOut, this._width, 200, 1, true);
yTween.onMotionFinished = function() {
trace("yoyo");
this.yoyo();
}
this.filters = [bl];
}
A simple left to right tween works ok
Code:
circle_mc.onEnterFrame = tweenBall();
function tweenBall() {
ballTween = new mx.transitions.Tween(this, "_x", Bounce.easeOut, this._x, 300, 15);
ballTween.onMotionFinished = function() {
this.yoyo();
};
}
So what's the right way??
I Am Using Mc Tween Class , But It Doesn't Always Work , Online.
I have been using the MC Tween class, and it seems to work really well, doing everything I tell it to. Locally, that is. But when I post it up online, it is unreliable, and sometimes just doesn't work.
I have a big site that basically has one main swf and then calls in other swfs. When the other swfs get called in... I typically have movie clips in them that have ,
onClipEvent(load) {this._alpha = 0; }
And then I tell them to....... alphaTo(100,.4,"linear");
or something similar to that. But it doesn't always work. And I can't figure out why. One thing I have been doing is....I am 'including' the mc tween class in each swf. Do I only need to include it on the main swf once? Does it perhaps hurt me to put the include code on every sub swf?
Yoyo() To Repeat A Tween Doesn't Seem To Work
Why the difference in tween and why doesn't
circle_mc.onEnterFrame = pulse;
work?
vs
circle_mc.onEnterFrame = pulse();
Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
//circle_mc.onEnterFrame = pulse(); //uncomment comment to test
circle_mc.onEnterFrame = pulse;//uncomment comment to test
function pulse() {
var yTween:Tween;
var xTween:Tween;
yTween = new Tween(this, "_yscale", Regular.easeOut, this._yscale, 200, 5);
//xTween = new Tween(this, "_xscale", Strong.easeOut, this._xscale, 200, 5);
yTween.onMotionFinished = function() {
this.yoyo();
}
}
with circle_mc.onRollOver = pulse; it does work
Anyone??
Button Inside Mc Doesn't Work
Ok, so here's a question:
I have a button "b1" which set "mymc" to visible by ac
mymc._visible = true;
inside "mymc" is a another button "b2" which comes visible with same ac ('cos it's build in to "mymc"). Mouse cursor changes as showing it is a button (turn into a pointing finger), however nothing happens if I click that "b2".
Is this a bug or is it just that there can't be a button inside mc.
(Or is it just user error that I can't see
Scroller Inside Of MC Doesn't Work
please help??
Right now if you put this scroller insdie a MC it doesn't work...any ideas?
http://www.studioxmedia.com/scroller.fla
Thanks,
Andrea
Why Doesn't This Work... Targetting An MC Inside MC
Inside my mc btn1 I have another mc called 'arrows' but when I target it nothing happens, it's meant to fade _alpha to 0... Any ideas?
Code:
for (i=0; i<numOfBtn+1; i++) {
this["btn"+i].num = i;
this["btn"+i].onRollOver = function() {
this.play();
this.arrows.alphaTo("0", .5, "easeOutQuad", 0);
};
HitTest On Mc Doesn't Work Inside Other Mc
Hi!
I have used this hitTest before to run a movie clip on mouseover - now I need to use it inside another movie clip. It works on the main timeline, so what do I need to change to get it to work inside the other movie clip?
Code:
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
if (this._currentframe<this._totalframes) {
nextFrame();
}
} else {
if (this._currentframe>1) {
prevFrame();
}
}
}
Hope someone can help me! Thank you in advance.
Why Doesn't This Work... Targetting An MC Inside MC
Inside my mc btn1 I have another mc called 'arrows' but when I target it nothing happens, it's meant to fade _alpha to 0... Any ideas?
Code:
for (i=0; i<numOfBtn+1; i++) {
this["btn"+i].num = i;
this["btn"+i].onRollOver = function() {
this.play();
this.arrows.alphaTo("0", .5, "easeOutQuad", 0);
};
AS On Buttons Doesn't Work Inside MC's?
I need some help, I'm sure this is fairly simple, I just can't figure it out.
I found the tutorial on "loading into target for MX" and "loading external .swf's with preloaders"... I got through them fine, and understand them and their logic, (I believe) with no problem. I was able get the AS to work perfectly in my own application UNTIL... I embedded the buttons themselves into a MC. I tried reworking the paths, but to no avail. the buttons "act" like buttons, but the AS never calls the external .swf, it's just dead.
I'm attaching a file that illustrates the use, and the way I've incorporated the AS. If anyone could help me sort this out I'd be very grateful...
Thanks a lot!
Why Doesn't This Work... Targetting An MC Inside MC
Inside my mc btn1 I have another mc called 'arrows' but when I target it nothing happens, it's meant to fade _alpha to 0... Any ideas?
Code:
for (i=0; i<numOfBtn+1; i++) {
this["btn"+i].num = i;
this["btn"+i].onRollOver = function() {
this.play();
this.arrows.alphaTo("0", .5, "easeOutQuad", 0);
};
AS On Buttons Doesn't Work Inside MC's?
I need some help, I'm sure this is fairly simple, I just can't figure it out.
I found the tutorial on "loading into target for MX" and "loading external .swf's with preloaders"... I got through them fine, and understand them and their logic, (I believe) with no problem. I was able get the AS to work perfectly in my own application UNTIL... I embedded the buttons themselves into a MC. I tried reworking the paths, but to no avail. the buttons "act" like buttons, but the AS never calls the external .swf, it's just dead.
I'm attaching a file that illustrates the use, and the way I've incorporated the AS. If anyone could help me sort this out I'd be very grateful...
Thanks a lot!
Why Doesn't This Work... Targetting An MC Inside MC
Inside my mc btn1 I have another mc called 'arrows' but when I target it nothing happens, it's meant to fade _alpha to 0... Any ideas?
Code:
for (i=0; i<numOfBtn+1; i++) {
this["btn"+i].num = i;
this["btn"+i].onRollOver = function() {
this.play();
this.arrows.alphaTo("0", .5, "easeOutQuad", 0);
};
Why Doesn't This Work... Targetting An MC Inside MC
Inside my mc btn1 I have another mc called 'arrows' but when I target it nothing happens, it's meant to fade _alpha to 0... Any ideas?
Code:
for (i=0; i<numOfBtn+1; i++) {
this["btn"+i].num = i;
this["btn"+i].onRollOver = function() {
this.play();
this.arrows.alphaTo("0", .5, "easeOutQuad", 0);
};
Alpha Tween Doesn't Work On Nested Clip
I have a movie with a nested dynamic text movie clip moving changing and alpha.
It works fine from its own timeline, but when I run the movie in test mode or published the alpha does not change (the movement still works, but is somewhat jerky).
The FLA file is huge, so posting it is a problem. I am trying now to replicate the problem with a simpler project. But maybe someone is familiar with the issue and can give me a hint?
JP
Scrollpane Doesn't Work Inside A Movieclip
I don't know if I am correct or not, but I have tried everything to make a scrollpane work inside another movieclip, but yet unsuccessful. But when it is on the main stage it works great!
Any ideas why this is?? Am I doing something wrong? Has anyone been successful with this?
Thanks,
Eric Ehle
GetChildByName Doesn't Work Inside AS File
Hi,
I am trying to get an open source Flex project to work in Flash, and currently the main issue I am having is that getChildByName doesn't work for some reason when called from an AS file that doesn't contain a class.
I admit I still haven't quite figured out the relationship between the main document class and additional AS files and how they connect...
Here's the situation:
In the AS file (in the Flex version) an already existing MovieClip (created in the main document class using scripting, i.e. it's not put on the stage using the interface) is being put into a variable.
In Flash, I get the error
1180 - Call to a possibly undefined method getChildByName
when trying to get the same task done.
My code for this line is:
var myClip:MovieClip = getChildByName("theClip");
I know I'll probably have to type cast it into a MovieClip, but I don't even get to that point yet.
I made sure that the MovieClip "theClip" has a name "theClip", and in other projects this has worked just fine.
I import flash.display.* to have access to DisplayObject.
There's gotta be something about AS files that I don't know yet that makes them behave differently, but I need to be able to access that MovieClip from within the AS file.
Any ideas?
Thanks!
Button Inside Movieclip Doesn't Work
Hello, I am quite new with flash and actionscript and I have a problem making a button symbol work in one of my movieclips.
This is what i have so far: click here
On the first frame, i have:
quote:stop();
menustrip_mc.onRollOver = function (){
gotoAndPlay("over");
}
"menustrip_mc" is a movieclip with only one frame. It contains the whole orange strip and the red square. The square is a simple button symbol.
So when i go over "basic" (picture one), the strip slides out with a simple motion tween. (picture two).
On frame 30 (end of motion tween), i wrote this code:
quote:stop();
menustrip_mc.onRollOut = function (){
gotoAndPlay("out");
}
When I roll out, the strip goes back in and the animation stops on frame 1 again.
All this works well except the button doesn't work, if i go over it during the motion tween, i can see the over state of the button but when the motion tween ends, it goes back to up state and doesn't do anything.
I tried many ways and nothing works (this one works best). Does anyone have an idea how to solve the problem?
TellTarget Doesn't Work Inside Functions?
I am creating a hangman-type game in Flash 5. To create the letter board with all the letters of the alphabet, I made a movie clip of a letter tile with a frame for each letter. There are 26 instances of the movie clip (Letter concatenated with A, B, C, etc. in order to have the correct letter display on each tile, I created the following function:
function setupLetters () {
tellTarget ("LetterA") {
gotoAndStop ("A");
}
tellTarget ("LetterB") {
gotoAndStop ("B");
}
etc through to...
tellTarget ("LetterZ") {
gotoAndStop ("Z");
}
OnEnterFrame Inside Prototype Doesn't Work
Check my little piece of code. Everything's going well, until the onEnterFrame. My MC instances aren't doin' anything!
Can anybody tell me what I'm doin' wrong?
ActionScript Code:
colors = [0x66FF00, 0x20DFD0, 0xEE1164, 0xDAE31C];MovieClip.prototype.drawCube = function(_moveY, _amount) { for (i=0; i<_amount; i++) { this.createEmptyMovieClip("cube"+i, i); this["cube"+i].lineStyle(1, colors[random(4)], 50); this["cube"+i].beginFill(0x2a0000, 80); this["cube"+i].moveTo(0, 0); this["cube"+i].lineTo(5, 0); this["cube"+i].lineTo(5, 5); this["cube"+i].lineTo(0, 5); this["cube"+i].endFill(); this["cube"+i]._x = random(Stage.width); this["cube"+i]._y = Stage.height-7; this.onEnterFrame = function() { this["cube"+i]._y -= _moveY; }; }};drawCube((random(7)+3), 10);
Thanks in advance!
Button Inside Movieclip Doesn't Work
Hi guys
Sorry for what is probably a stupid question.
I'm building a navigation menu.
In the first frame of the main time line i have 7 movieclips which are buttons. Within these movieclips there are additional buttons with a simple rollover function to change the background colour.
The problem I'm having is that the action on the buttons doesn't work. I'm guessing this is something to do with the AS i have within the mc.
I've had a good look through the forums and on Google but have yet to find the answer. So I'm hoping someone here can help or point me in the right direction.
I've attached the fla.
Thanks for reading
Russ
AttachMovie Doesn't Work Inside For Loop
I have an xml file with 26 elements representing the alphabet so i can make a glossary (glossary.xml)
I am trying to attach a MC (pointer) for each letter/element in the xml file and add in the appropriate letter to a textbox (alpha_id) inside the MC.
However for some reason attachMovie won't work inside my for loop. Can anyone help me out here?
here's my code:
Code:
//load xml file
var external_xml:XML = new XML();
//ignore all extraneous whitespace
external_xml.ignoreWhite = true;
external_xml.load("xml/glossary.xml");
external_xml.onLoad = function(success:Boolean) {
if (success) {
temp_xml = this.firstChild;
lgh = temp_xml.childNodes.length;
for (i=0; i<lgh; i++) {
var alpha = temp_xml.childNodes[i].attributes.id;
//have also tried 'this._parent' as an experiment - no luck
this.attachMovie("pointer", "pointer"+i, this.getNextHighestDepth());
this["pointer"+i]._x = 40;
this["pointer"+i]._y = 40+(i*(this["pointer"+i]._height+10));
//there is a textbox instance named alpha_id in the mc pointer to accomodate each letter of the alphabet
this["pointer"+i].alpha_id.text = alpha;
}
}else {
trace ("Error");
}
};
Cannot Reference A Tween Inside A Function.
Hi
Im sure im being a bit stupid but i cannot seem to reference a tween inside a function. Just want to use tweenName.stop(); and tweenName.resume(); but no dice. Can anyone shed any light?
Thanks
Tween Code
Code:
//////////load stuff
import mx.transitions.Tween;
import mx.transitions.easing.*;
//////////variables
var restart:Boolean = true;
var targX:Number = 0;
//////////functions
function fadeClip(who, targX){
var tw1:Tween = new Tween(who,"_x",Regular.easeInOut,who._x,targX,100,false);
tw1.onMotionFinished = function() {
tw1.yoyo();
};
}
fadeClip(clip01,0);
Button Code
Code:
clip01.onRollOver = function(){
//trace("fading uP");
//if(rolled == false){
tw1.stop();
}
clip01.onRollOut = function(){
tw1.resume();
}
Removing A Movie Clip From Inside Itself Doesn't Work :(
For some reason, I can't remove a movie clip from inside itself. I even tried using a function on the _root timeline, and calling it from within the movie clip, and it still didn't work.
Here's what I'm currently using to try to remove it from within itself (doesn't work):
code:
removeMovieClip(this);
I also tried this:
code:
this.removeMovieClip();
The function I attempted to use looked like this:
code:
killMe = function (target)
{
removeMovieClip(target);
//This function is on the _root timeline
}
And the call in the movie clip looked like this:
code:
_root.killMe(this);
Any ideas, explanations, workarounds? I did remember to search this time, by the way.
Thanks!
Rick
Edit: I can, however, MOVE the movie clip from within itself
GoToAndPlay Action Doesn't Work From Inside A Movieclip?
I have a button that is 2 levels under the main timeline inside of a movieclip and it will not accept a simple "onrelease gotoandplay" action. do i need to add something in the code to tell it to play on the root timeline?
Right now it just says:
on (release) {
gotoAndPlay("testimonials", 11);
}
and it's two levels under the root timeline.
Button Inside Symbol(movieclip) Doesn't Work. Plz Help. Thanks
I created a drop down menu which contains 3 buttons(home, contact, game). I had tried to put onRelease on its button itself, it couldnt work. Same as another method which the script on the layer actions. Can anyone please tell what is wrong with my flash? I'm still begginer in flash and i'm really clueless now. I had attached my file into this thread. Please have a look. Thousand thanks
Rollover Buttons Inside Movieclip Doesn't Work
Hi guys
sorry i have this stupid beginner problem here
and I have tried to search related issues but I still can't figure the way to make my buttons work
http://www.angiehu.com/upload/showroom/test2.fla
here is my fla file...
Basically I have a rollover buttons inside a movieclip and my action script in the first frame of the scene is the following
_root.designer_mc.b1_01.onPress=function(){
goto("designer01");
}
b1_01 is the instance of the button inside designer_mc movieclip~ however I realized that buttons won't work in movieclip
and i just don't know what's other solution
I will be really appreciated if anyone can teach me how to get this fixed~ i m so stuck and I have wasted my past 2 days trying to figure this out and still no result...
I have learned flash at least 5 years ago and now I found out that actionscript works a lot different than before and I can't make things work (damn it)
Buttons Inside Movie Clip Doesn't Work On Over
Hi all,
please help because i am loosing my head. i'm not an expert flash user but I wouldn't say that I am a novice one either.
Into the problem.
I am trying to do a drop down menu. I have used a movie clip to create the effect and in there are the buttons. I am using the root to control the actions. It works fine but when I add the code for the RollOut event the buttons stop having the over effect like to change the font colour etc.
What am I doing wrong?
I have made a douzen variations and I have attached one of them. (i'm not sure if it's attached though)
here is the code placed on the root for the button Vision Support, that's the only one trying to implement since the morning!
this.support_mc.onRollOver = function(){
this.gotoAndPlay(2);
DDSupport_mc.gotoAndPlay(2);
};
this.support_mc.onRollOut = function(){
this.gotoAndPlay(16);
};
this.DDSupport_mc.onRollOut = function(){
this.gotoAndPlay(70);
};
please please help
Set( ) Function, Doesn't Work Like I Want
I'm trying to make this work. . .
line 1: set(oldscore, "p"+playerno+"score");
line 2: _root.oldsegment = ("p"+playerno+"_"+number);
line 3: set("p"+playerno+"score", (s*number)+oldscore);
line 4: set("p"+playerno+"_"+number, s + _root.oldsegment);
Obviously there I tried a couple different methods to get what i wanted, none of them work *except lines 3 and 4, but those don't technically work because lines 1 and 2 are worthless. So how can i fix lines 1 and 2?
all done in Flash MX
Mark
Function Doesn't Work
Hello, I have been working on a peice of code I made and it isnt working as expected. What it's sopposed to do is play a random movie clip in an array. Why is this not working.
Code:
function playTracers() {
var myTracers:Array = [tracer1,tracer2,tracer3];
var randomTracers:Array = [];
var randomCount:Number = 1;
var r:Number;
for (var i = 0; i<randomCount; i++) {
r = Math.floor(Math.random()*myTracers.length);
randomTracers[randomTracers.length] = myTracers.splice(r, 1);
}return randomTracers;
}playTracers();
Thanks
Getting This Penner Motion/easing Function To Work
Hello,
I am attempting to get a MC to move/ease from down to up with the help of AS without resorting to tweens...
Mind you, I am still working with Flash5.
Right, I found this Robbert Penner function:
ActionScript:
onClipEvent(load)
{
Math.easeInElastic = function (t, b, c, d, a, p) {
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs ) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
};
}
I placed it on a MC (a different one from the ones mentioned below) on frame 1 on _root
With it I want to make a MC (lets call this MC Bob) move from down to up (out of sight) after the timeline in another MC (hostMC) has reached a certain Frame (lets say frame 23).
Since I have to tell Flash to execute this function (which I am forced by Flash5 to put functions within a ActionScript:
onClipEvent(load){
}
I put ActionScript:
onClipEvent(load){
_root.bob.Math.easeInElastic;
}
attached to another MC which I placed inside hostMC on frame 23.
Needless to say, it doesnt work.
But what am I doing wrong?
Combo Boxes Doesn't Work Inside Window Component
Hello again,
I have two .swf files. A parent swf uses a window component that's contentpath is equal to the second swf file.
The second swf file contains a combobox component. When I run the second swf file the combo box works fine; when I call the same swf from within the first swf (under the window component) the box will not "drop down"... it just sits there like a stoned rock.
Any suggestions?
Combo Boxes Doesn't Work Inside Window Component
Hello again,
I have two .swf files. A parent swf uses a window component that's contentpath is equal to the second swf file.
The second swf file contains a combobox component. When I run the second swf file the combo box works fine; when I call the same swf from within the first swf (under the window component) the box will not "drop down"... it just sits there like a stoned rock.
Any suggestions?
Image Scroller Script Doesn't Work When Put Inside Movie Clip
I've given up trying to figure this out myself as I'm new to this and desperately in need of help.
I got a script which is an image scroller. I've attached the fla in question and the problem seems to be in the 'controller' MC which you can see in the assets. This is what controls the button actions to the slides.
I want to be able to put this in another movie clip so that I can refer to it from another mc and then this shoudl start playing.
Will really appreciate your help!
BTW I am using Flash MX 2004.
Dynamic Text From .txt File Doesn't Work Inside Movie Clip
Let me start by explaining...
I have a 10 Scene flash movie / website. Everyscene has it's own cool animation. (To see what i mean check out http://69.41.144.121/aerocet/index.html). There are many layers in each scene and each scene has a lot of symbols. I am trying to load text from a txt file dynamically into a movie clip called t_info_text1 which is also inside Symbol 82 which is a symbol of Scene 2. I can't ever manage to see the text in the compiled site. I've tried many different paths the the object and such. Is there just a trick I am missing, or scripting I am getting wrong?
Again:
Textbox instance name about_txt var about
Part of Movie Clip t_info_text1
Part of Symbol 82
Part of Scene 2
Part of SWF
in same directory on HDD is about.txt which contains the following:
&about=Some text about us
in Frame 1 of Scene 2 actionscript reads the following
loadVariables("about.txt",0);
about_txt.embedfonts = true;
I have already embedded my fonts and they work fine, If i paste the text into the textbox it will show up, but if I load it froma text file, it's no go....
What can I do?
Why Doesn't This Fading Function Work?
I wrote this function hoping to fade an mc in and out on rollover of a btn. The mc's instance name is "panel"... I just want to fade the panel mc in and out. here's the script:
Code:
this.but1.onRollOver = function() {
this.panel.clientTxt.text = "TEXT HERE....";
this.panel.yearTxt.text = "YEAR GOES HERE";
this.panel.descTxt.text = "Text and more text, text text text, blah blah blah blah blah blah...";
startFadeIn();
};
//---------------------
this.but1.onRollOut = function() {
startFadeOut();
};
//---------------------
//---------------------
// Holds the interval ID, used to remove the interval
var intervalID;
// Interval in ms (50ms equals 1/20 seconds)
var interval = 50;
// Speed of fade, bigger number -> faster fading
var fadingPower = 8;
// Start the fading
//---------------------
function startFadeIn() {
intervalID = setInterval(doFadeIn, interval);
}
//---------------------
function startFadeOut() {
intervalID = setInterval(doFadeOut, interval);
}
//---------------------
// Function is called when the fading happens
function doFadeIn() {
if (this._alpha<100) {
this._alpha += fadingPower;
} else {
clearInterval(intervalID);
}
}
//-------------------
function doFadeOut() {
if (this._alpha>0) {
this._alpha -= fadingPower;
} else {
clearInterval(intervalID);
}
}
any ideas what i did wrong?... or a better way to accomplish the same thing? Any help would be appreciated. TIA
Why Doesn't This (simple) Function Work?
Hi Guy, I'm missing something obvious - I try hard to code but often get the fundamental stuff wrong.
I am trying to remove having to fully code all my buttons with a lot of code, move that code into a main function on the root timeline, and then call it with parameters within the button. The code works before I convert it into a function when I target each button and use non-generic code without the function.
Here is the function on the main timeline that doesn't work (this is in Flash 8):
function doButton(
butLoc,butTweenLoc,txtTweenLoc,
txtTitle,txtColor,
releaseLabel
)
{
import mx.transitions.easing.*;
import mx.transitions.Tween;
butLoc.title_mc.title_txt.text = "Home";
butLoc.title_mc.title_txt.textColor = 0x00ffff;
butLoc.onRelease = function() {gotoAndPlay("home");};
butLoc.onRollOver = function() {
bgTween = new Tween(butTweenLoc, "_alpha", Regular.easeOut, butTweenLoc._alpha, 50, .5, true);
titleTween = new Tween(txtTweenLoc, "_x", Regular.easeOut, txtTweenLoc._x, 15, .2, true);};
butLoc.onRollOut = function() {
bgTween = new Tween(butTweenLoc, "_alpha", Regular.easeOut, butTweenLoc._alpha, 100, .5, true);
titleTween = new Tween(txtTweenLoc, "_x", Regular.easeOut, txtTweenLoc._x, 5, .2, true);};
};
And here is what I put around (not on the button, but in the same frame number):
butLoc="this.gal0GoHome1"
butTweenLoc="this.bg_mc"
txtTweenLoc="this.title_mc"
txtTitle="Home";
txtColor="0x00ffff";
releaseLabel="home";
doButton();
FWIW this works but I need the full code for each button instance:
import mx.transitions.easing.*;
import mx.transitions.Tween;
this.home0.title_mc.title_txt.text = "Galleries";
this.home0.title_mc.title_txt.textColor = 0x00ffff;
this.home0.onRelease = function() {gotoAndPlay("galleries");};
this.home0.onRollOver = function() {
bgTween = new Tween(this.bg_mc, "_alpha", Regular.easeOut, this.bg_mc._alpha, 50, .5, true);
titleTween = new Tween(this.title_mc, "_x", Regular.easeOut, this.title_mc._x, 15, .2, true);};
this.home0.onRollOut = function() {
bgTween = new Tween(this.bg_mc, "_alpha", Regular.easeOut, this.bg_mc._alpha, 100, .5, true);
titleTween = new Tween(this.title_mc, "_x", Regular.easeOut, this.title_mc._x, 5, .2, true);};
Any help with my stupidity here would be greatly appreciated...
Shawn
Date Function Doesn't Work :( Again
could anyone help me out of this
I've made 6 clocks like this, each of them show 1 specific time of 1 specific area in the world.
but dont know why date function doesnt work. they all display 1 date only, which is Jun 26
Thank you
P.
// I couldnt attach the file, sorry.....
stop();
my_time_function = function(message){
now = new Date();
nMonth = now.getUTCMonth();
thisDate = now.getUTCDate();
thisYear = now.getUTCFullYear();
nHour = now.getUTCHours()+7; //get GMT+7 Hanoi
nMinutes = now.getUTCMinutes();
if(nMinutes < 10){
nMinutes = "0"+nMinutes;
}
nSec = now.getUTCSeconds();
if(nSec < 10){
nSec = "0"+nSec;
}
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
my_date.text = months[nMonth]+"-"+thisDate + ", " +thisYear;
};
time = setInterval(my_time_function, 1000);
UnloadClip Function Doesn't Work
this.dots_btn.onRelease = function() {
myMCL.loadClip("dots/interiordots.swf",1);
}
this.dots_btn.onPress = function() {
myMCL.unloadClip("homeimage.swf");
}
I have this on frame 10. THe loadclip function works, but the unloadclip function does not. Is this not how unloadclip works, or how you are suppose to right it? The button is on the main stage and the "homeimage.swf" was loaded on frame 1 into level 2.
THANKS!!!
GetURL Function Doesn't Work
Hi I'm trying to launch a new browser window from flash to open up a pdf document. This is the script I am currently using:
on(release){
getURL("pdfs\timetable.pdf", _blank);
}
This works fine in IE but for some reason does not work in Mozilla Firefox (which I'll need it to work in as well). Does anyone know a solution to this?
Thank You
Why Doesn't This Simple Function Work?
Check out this simple attachment. You got your as
my_btn.onRelease = function() {
trace("It worked");
}
The Instance Name on the button is my_btn. Ok, why does it work if the as is on the same frame as the button but not if you move the button over a frame. I thought the point of using a function was that you only need to write it once. I don't want to put this function on every frame where the button is located.
What am I missing here?
|