Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Reverse MC Function Issue?



Hi Guys.

Does anyone know of a reverse MC function for Flash Player 8? I've used one before but it only works in version 6. This one:


ActionScript Code:
Movieclip.prototype.backUp = function(howManyFrames) {    this.createEmptyMovieClip("revController", 100);    this.revController.howMany = howManyFrames;    this.revController.onEnterFrame = function() {       if (this._parent._currentframe >1 and this.howMany>0) {          this._parent.gotoAndStop(this._parent._currentframe-1);          this.howMany--;       } else {          this.removeMovieClip();       }    }; };

does anyone know what I nedd to alter for it to work in player 8? or of a new function for player 8? I've googled it and cabt find anything!

Thanks in advance
Phil



ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 10-18-2006, 01:49 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Please Help With Reverse Issue
Ive read up on how to do this, but i cant seem to get it, i am a retard when it comes to action script. What im trying to do is make the movie run in reverse when it hits the last frame then when it hits the first frame to run forward again, sorta like a loop. I have attached the fla that i cant seem to get working, thanks for any help.

Reverse MC Issue Pls Help
hi,

i am a newbie with flash ..... this is my 1st post on this forum....

made this mc ... similar to the animation on right (advertisement) on

www.informationweek.com

got the bit where the page curl roles out ... but i cant get it to role back on rollout

could you pls let me know how to get this done

thanks in advance

Another Reverse Playback Issue...
howdy all...

man there seems to be tons of this problem here....i have tried just about every script here and still cannot get this thing to work. my animation is a ball on a circular motion guide. i have 2 buttons, 1 controls a clockwise motion, and the other (is supposed to)counter clockwise....the clockwise works flawless, but i cannot figure out the script to reverse the frames on the second button. if someone could please take a look at this .fla and let me know what the heck it needs to work, it would be greatly appreciated.....thanks!

*note - actions for both buttons are the same

: : : anemonE

Reverse Frames Issue
Can someone help. I am trying to get my button to play my frames backwards. All that my code does is jump back to the first frame.


Code:
on (release) {
for (i=1; i<18; i++) {
this.gotoAndStop(this._currentFrame-1);
}
}

Tricky Reverse Issue
I need some help with a reverse problem.
I have a mc with 37 frames with stop on frame 1, 19 and 37 and should be controlled by 2 buttons.
On one button I have the following code.

on (release)
{
if (_root.bmw360._currentframe == 1) {
_root.bmw360.gotoAndPlay("2");
}else if (_root.bmw360._currentframe == 19) {
_root.bmw360.gotoAndPlay(20);}
}

Now i need som code on button 2 that plays it backwards.

ie
on (release)
{
if (_root.bmw360._currentframe == 19) {
_root.bmw360. play backwards from 18 to ("1");
}else if (_root.bmw360._currentframe == 37) {
_root.bmw360. play backwards from 36 to (19);}
}

I dont think that the above code is right at all but it tells how I want it to function.

I tried another really great code for reverse found here but that didnt worked right for this problem, or does it?
So please can someone help me with this?

Reverse Play Button Issue
Hello you wonderful forum people!

I have a button (actually a MC) that plays reverse when you hover over it.

Everything works great, no problem at all. My question is regarding the starting point...

I'll try to explain best I can...

You'll notice that when you start this SWF, at the very beginning, button (MC) is animating from the ending point (I marked it with black "END" text) to the starting point (I marked it as white "START" text inside the black circle).

That's exactly how it suppose to be when you roll out that button, and when you are hovering over it, button (MC) is animated from the START point to the END point.

Is there any way to set that button so it doesn't animate immediatelly when you start that SWF ? I mean, I don't want to see that animation from the END point to the START point, I want that button to "sit" on START frame and wait until I hover over it... then animation from START to END should begin, and of course when you roll out that button, animation from END to START should normally play.

It's just that first little thing when you start this SWF. It shouldn't animate, it should begin with START frame and stand still until I hover over that button.

Both, SWF as well as FLA files are attached...

Many THANKS in advance !

Reverse Clip & Sound Sync Issue.
I have a clip that plays forwards on (rollOver) and then backwards on (rollOut)

The only problem is I have a sound byte on the timeline that plays great when playing forward but doesn't sound right when played reverse.

I know it's because the sound is triggered to the frame it starts from but what would be the best way to make the sound play properly in both forwards and reverse?

I can attach a sample if neccessary.

Thanks,

Darren

Print Function In IE Reverse Swf
Hello,

I'm impressed with the print function of IE !!
check www.cellplus.mu and press the print button of IE.
it will inverse the SWF. The thing is, it wasn't supposed to do that.
Anyone has encountered this problem. any suggestion to fix that bug???!!!

thanks
alien

Reverse Script Function.
Hi!

I want to modify a simple code, but i just cant figure out how to make the change i want to achive.

Now, if you place the code on a nested movieclip placed on the stage the object will resize when the mouse is close to the parent object.

If you place alot of instances next to eachother on the stage you will get this neat effect. However, i want to reverse the effect, so instead of making the instace smaller i want to enlarge it.

The code is as followed:


Quote:





onClipEvent (load) {
baseX = _parent._x;
baseY = _parent._y;
}
onClipEvent (enterFrame) {
distanceX = _root._xmouse-_parent._x;
distanceY = _root._ymouse-_parent._y;
if (distanceX < 0) {
distanceX = -distanceX;
}
if (distanceY < 0) {
distanceY = -distanceY;
}
distance = Math.sqrt((distanceX*distanceX)+(distanceY*distanc eY));
if (distance < 110 and distance > 40) {
_parent._xscale = distance;
_parent._yscale = distance;
}
}
onClipEvent (mouseMove) {
updateAfterEvent();
}





If anyone could help me with this matter it would be most appriciated.

Thanks in advance for any responce

My Movieclip Reverse Not Function..
hi, i wonder y my movieclip is not reverse playing when the user rollout the button. i follow this forum example:
forum sample
actually, it suppose to work. y?? if i copy my movieclip frame n paste into the sample file movieclip frame. it works. y??

pls help me out..

Reverse Number Function
ActionScript Code:
function PrintReverse(i:Number, r:Number = 0):Number {    trace(i+" : "+r);    return (i<1) ? r : PrintReverse((i-i%10)/10, Math.floor(r*10+(i%10)));}trace("output: "+PrintReverse(123456789));/* OUTPUT123456789 : 012345678 : 91234567 : 98123456 : 98712345 : 98761234 : 98765123 : 98765412 : 98765431 : 987654320 : 987654321output: 987654321*/


Quick code... should work in AS2 or AS3 (using the Number datatype above or using int). If you feed it a decimal, it'll only output the reversed integer part, it discards the fractional part (ie. put in 12345.6789 and it'll output 54321).

Reverse A Function (w. For Loop)
hello team actionscript once more.

a client asked me to build a simple header, with a few animations and buttons.
so far so good
now as a finisher i'd like to reverse the function while a new page loads
now thanks to the nice reverse() function for arrays i was able to do this
fairly simple.

but one remark/oddity

using the code i pasted below, once i click the unloadMenu function
the last mc (mc4) just directly to place
while mc3, mc2 and finally mc1 nicely tween out
actually this is also in the init function mc1 directly jumps to place followed by mc2 > mc4 nicely tweening in.

can any one point me out what i am doing wrong?

I tried to replace in the unloadMenu function " i " for a new count variable
because i thought flash was having problems with that. but thats to no avail.
I did a fair attempt on searching for this. but the results couldn't help me fix this.
also the code beneath is a blueprint, and i left some parts out, but this should be enough to see the problem.

thanks in advance.

Code:

//imports
#include "lmc_tween.as"
//
//navLoc 1 > 4 is coming from xml input this changes over the different pages all the time.
var mybuttons:Array = new Array (mc1, mc2, mc3, mc4);
var mynames:Array = new Array (navLoc1, navLoc2, navLoc3, navLoc4);
var xLoc:Number = new Number ();
var spacer:Number = 5;
var Xstart:Number = 200;
//   opens menu
function init ()
{
   for (var i:Number = 0; i < mybuttons.length; i++)
   {
      mybuttons[i].label_txt.autoSize = true;
      mybuttons[i].label_txt.text = mynames[i];
      mybuttons[i].tween ("_y", Stage.height / 2, 0.6 * i, "easeOutSine");
      mybuttons[i]._x = Xstart + xLoc;
      xLoc += (mybuttons[i].label_txt._width + spacer);
      //
      // for testing only (REMOVE)
      mybuttons[i].onRelease = function ()
      {
         unloadMenu ();
      };
      //
   }
}
//
init ();
unloadMenu = function ()
{
   mybuttons.reverse ();
   for (var i:Number = 0; i < mybuttons.length; i++)
   {
      trace ("my buts : " + mybuttons);
      mybuttons[i].tween ("_y", 10, 0.6 * i, "easeOutSine");
   }
};

[CS3] Make Tween Reverse Within Function?
Hi everyone,

I'm building a fullscreen website for my client and i'm using tweenclasses for some simple animations.

When clicking a button, a menu moves from (menu._y-155) to his original position (menu._y). This part works.

I want to reverse this tween when clicking the button for the second time, but I can't use absolute coordinates, because of the fullscreen positioning of the menu.
So I want to use the onMotionFinished reverse function for the second click.
How exactly can I achieve this?
I know I can make a new tween with the opposite parameters, but that doesn't work when scaling the browser.

This is my AS so far:


PHP Code:




stop();

import mx.transitions.Tween;
import mx.transitions.easing.*;

var incr = 0;
personal_but.onRelease = function() {
    incr++;
    if (incr>1) {
        incr = 0;
        reversing();
    }
    if (incr == 1) {
        forwd();
    }
};
function forwd() {
    _root.gotoAndStop("personal");
    var Personal:Tween = new Tween(_root.personal_mc, "_y", Elastic.easeInOut, (_root.personal_mc._y)-155, _root.personal_mc._y, 32, false);
};
function reversing() {
    Personal.reverse();
};







The forwd works great, but the reversing part doesn't...
Any ideas?

Many thanks!

Reverse Function With Loadmovie Button
I have this action setup to where it calls a movie clip when you click open and when you close it the movie clip plays backwards but now I need it to do the samething with a .swf file but everytime I click it the file opens but doesnt play backwards so how sould I go about doing this with this action that I have put together.

This is what I have so far and I dont know why it wont play backwards the file comes up but when I want it to play backwards it just goes to frame 1 and does the samething again.


ActionScript Code:
stop();

function playBack (name:String):Void {
    var mc = this[name];
    if ( mc.played ) {
        mc.played = false;
        mc.onEnterFrame = reverseNow;
    } else {
        mc.played = true;
        mc.onEnterFrame = playNow;
    }
}

function reverseNow (Void):Void {
    this.prevFrame();
    if ( this._currentframe == 1 ) {
        this.stop();
        delete this.onEnterFrame;
    }
}
function playNow (Void):Void {
    this.nextFrame();
    if ( this._currentframe == this._totalframes ) {
        this.stop();
        delete this.onEnterFrame;
    }
}

maximus.onPress = function (Void):Void {
    maximus1.loadMovie("maximus1.swf");
        playBack(this._name + "1");
    playBack("closemax");
}

Function Issue
Hi. I have this function, wich is supposed to cheoose a number, 1 or -1, and show the result in the var sinal:
function escolheSinal(sinal) {
sinal = Math.random(2)-1;
if (sinal == 0) {
sinal = 1;
}
return (sinal);
}

Now, I want to call the function, and get the result of sinal:
escolheSinal(sinal);
velocidadeY[i] = speed*sinal;

This is not working, what am i doing wrong???

Function Issue
Hi,

I have two buttons - left and right arrows to scroll multiple movie clips in desired direction. I pass the name of the movie clips i want to move to the function.

Each button I call the same function for each and just pass the movie name to it.

_root.box.left_arrow.onRelease = function(){
moveMovie("movieOne");
moveMovie("movieTwo");
moveMovie("movieThree");
};

Unfortunately, only one movie clip will move... depending if it is the first function call under the onRelease call.

Any advice would be greatly appreciated.

Thanks

[F8] Function Issue
Code:
linkToGo = list[test.test.selectedIndex][0];



if (_root._currentframe == 1)
{
_root.gotoAndPlay("Charts");

loadMovie("swf/"(linkToGo)".swf", _root.loadchart);
}

as you can see my issue is in the loadMovie, i need to load say
swf/thislink.swf from the array linkToGo

any pointers would be great

[F8] An Issue With A Function
I'm probabaly missing something blatantly obvious and/or being dumb here but I've put a function in the first frame of the top layer of my flash and I'm trying to call it but it's not working.

The functions purpose is to make sure all the drag and drop icons are set to their default colour (Frame 1).

I'm calling this function just before doing a gotoAndStop(2) to change the colour of the last drag and drop icon used.

Basically I want the only last icon that was dragged incorrectly to show as red.

The code has been implimented on the 3 drag and drops in the top left corner.

Link below to the flash file.

http://www.2shared.com/file/3665792/4e440fd5/DLFL8.html

Click "Click here" in the bottom right to download.

Many thanks in advance for any help that can be provided.

Function Issue =(
I am having a slight problem with a function I'm trying to run. Here is an example of what is exactly going on.

(not code, but example):

---------------------------------


Code:
function myFunction (functionName, functionValue) {
functionName.gotoAndPlay(functionValue);
}

this.myFunction(one_mc, 10);
this.myFunction(two_mc, 10);
---------------------------------


So basically what I'm trying to do it call the same function twice, or is that not possible? I even tried putting:

_parent.myFunction(one_mc, 10);
_parent.myFunction(two_mc, 10);

in their own timelines (one_mc and two_mc) and it still only runs the function once, which one ever gets called first.

thank you in advanced =)

Function Issue
Ok i have the line labeled that works and the line labeled that doesnt.
The only reason i see this not working is because its within a function. If I move the line "this._parent.tixChange.gotoAndPlay(5);" outside of the function it works fine. Any ideas ?


ActionScript Code:
function killInterval() {
    clearInterval(intervalID);
}
stop();
function stopHere() {
    this._parent.tixChange.gotoAndPlay(5); <- broke
               _root.tixChange.gotoAndPlay(5); < -works
    killInterval();
}
var intervalID;
intervalID = setInterval(stopHere, 2000);
//this._parent.tixChange.gotoAndPlay(5); <- works if placed here??!!
 

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!

Function Parenthesis Issue
Hello
Can anyone please explain to me the proper use of parenthesis in using functions? I have the following problem:

Frame 1 (of _root):

Code:
stop();

myXML = new XML();
myXML.onLoad = load_data();
myXML.load("xmlfile.xml");

function load_data() {
something = retrieve some XML data;
trace(something);
_root.gotoAndStop(2);
}


Frame 2 (of _root):

Code:
stop();

trace(something);


Both traces output "undefined", even though the XML data get in the load_data function is correct.
If i remove the paranthesis from row 4

Code:
myXML.onLoad = load_data;

the load_data function does not launch

On the other hand, if i have a something like
Frame 1:

Code:
function main() {
something;
}

onEnterFrame = main();


main does not launch. it only works after removing the paranthesis like this:

Code:
onEnterFrame = main;


To top it off, i have another FLA in which i use the exact same code as the first and the load_data returns undefined data when using WITH paranthesis and does not launch at all when using without them.

However, the code does work and return what it should when i use it without paranthesis AND i have on the second frame of the main timeline the following code (an empty / do-nothing function):


Code:
onEnterFrame = function() {}


What is going on here?

Can anyone make sense of this? Please help.
thanks

[f8] Syntax Issue With A Function
Hi all,

I Have a function written out to preload my pages in my flash movie.

However the problem I'm running into is being able to snatch up the bytes_loaded/Total of each of the clips inside my function.

The Function:

Code:

Code:
//Create Function to Handle All Page Preloads
function PreloadPage(Page, Name)
{
trace("Triggered Page Load Function!");

// / Section with problem / //

MCName = _root.LoadedContent_mc.LoadedContent2_mc+Page;

// /Section with problem / //

bytes_loaded_P = Math.round(MCName.getBytesLoaded());
bytes_total_P = Math.round(MCName.getBytesTotal());
get_percent_P = bytes_loaded_P / bytes_total_P;
Rounded_percent_P = Math.round(get_percent_P*100);

_root.Preloader_MC.LoaderTxt = Rounded_percent_P+"%";
_root.Preloader_MC.LoadDescription = "Loading "+ Name +"...";

trace("LoadedBytes: "+bytes_loaded_P);
trace("TotalBytes: "+bytes_total_P);
trace("Percentage Loaded: "+_root.Preloader_MC.LoaderTxt);

if (bytes_loaded_P == bytes_total_P)
{
trace("Fired Load Success "+ Page +"!!");
_root.gotoAndPlay("Content");
}
else
{
_root.Preloader_MC.gotoAndPlay("_PreloadRepeatScene");
}
}


The problem with it is that I can't seem to get my variable "Page" to be stuck into the .(dot) sequence that targets the correct movie clip.

Thanks in advanced for your suggestions,

`eff

Scoping Issue And Function
Hi:

Can someone help me with a scoping issue?

SWF A is being loaded into SWF B. Currently, there's a function located in SWF A that is triggered by a user clicking on a movieclip in SWF A. Basically, I am trying to make it trigger from a button in SWF B, instead of triggering by a button in SWF A.

When a user clicks Button B (located on SWF B), I would like it to call the function located in SWF A. This function cause a menu to slide from the left side.

Thanks,
Loren

Function Variable Issue
I know this is silly, but I can't figure it out. I wrote a simple little function to flicker the opacity of a movieclip, but when I try and apply it to more than one clip at a time, it only works for the second clip. I think this is because the variables of the function get overwritten when the function is called for a second time. Here's the function:


Code:
function flicker(clip, limit, startAlpha, endAlpha, range) {
var listen = "listen_" + clip;
_root.createEmptyMovieClip(listen, 0);
trace(listen);

var flicker;
var i = 0;

_root[clip]._alpha = startAlpha;

_root[listen].onEnterFrame = function() {
if (i < limit) {
flicker = random(range);
_root[clip]._alpha = startAlpha + flicker;
i++;
} else {
_root[clip]._alpha = endAlpha;
delete this.onEnterFrame;
}
}
}

flicker("MC1", 1000, 0, 15, 60);
flicker("MC2", 100, 0, 15, 10);
In the example above, MC1 does not flicker, but MC2 does.

Issue With SetInterval Function.
This is a simplified version of the actual project I'm working on, but it's basically set up the same way, I haven't been able to get much help from anyone on this yet, but maybe someone here will know how to deal with this

The main file contains a blank movie clip (loader_mc), it's set to load "mc_1.swf" by default. If one of the movie clips contained inside of mc_1.swf is clicked it changes the value of the _root variable stuff (_root.stuff) to 100. This is in turn supposed to then call the setInterval function callback0. I'm doing this because, in my more complex version, I need to have a delay to allow an animation to finish. The setInterval function callback0 is then supposed to load "mc_2.swf" into loader_mc. The problem is, for whatever reason, the damn thing gets caught in an endless loop that continually loads mc_2.swf.

Does anyone have a clue as to why it's doing this?

Here's the code, and I've also attached the entire project.


Code:
loadMovie("mc_1.swf","loader_mc");
_root.stuff = 0;

function callback0(){
clearInterval(intervalID);
loadMovie("mc_2.swf","loader_mc");
_root.stuff = 0;
}

function callback1(){
clearInterval(intervalID);
loadMovie("mc_1.swf","loader_mc");
_root.stuff = 0;
}

box.onEnterFrame = function(){

if(_root.stuff == 100){
intervalID = setInterval(callback0, 1000);
}

if(_root.stuff == 99){
intervalID = setInterval(callback1, 1000);
}
trace(stuff);
}

Path Issue With Function?
Does anyone know how I can take the following script from the root level and invoke the functions within an MC?


Code:
//initiate timer paramaters
timerInit = function() {
//getting the time at this point
startTime = getTimer()/1000;
//setting the waiting period
waitFor = 3;
//5 seconds
}

//start the timer
timerPause = function () {
if (waitFor>((getTimer()/1000)-startTime)) {
gotoAndPlay("pause");
} else {
gotoAndPlay("begin");
}
}

Issue With Var Inside Function
I have a for loop that is adding button functionality to 16 buttons on the stage. It is targeting the button fine with no problem using the var i as the button number. The issue is inside the button function I have another nested button function for the on state of the button which I also use the var i to specify the url number I want associated with the particular button but it is always outputting 17. I don't even understand how it is getting that number. Here is the code.









Attach Code

function gotoURL(movieNum) {
getURL("javascript:flashURL("+movieNum+");");
}
// ----
for (i=0; i<=16; i++) {
this["b"+i].onRelease = function() {
// -- bring selected button to the top deptht
_root.x += 2;
this.swapDepths(_root.x);
// -- defines last selected button and then delete it
var lastBtn:MovieClip;
this._parent.lastBtn.gotoAndPlay(11);
trace("Button Event One");
this.gotoAndPlay(2);
delete this._parent.lastBtn.onPress;
this._parent.lastBtn = this;
updateAfterEvent();
// -- If the user clicks the on state then it goes to some URL
this.onPress = function() {


_root.gotoURL(i);
trace (i);


trace("Button Event two");
updateAfterEvent();
};
};
}

Path Issue With Function?
Does anyone know how I can take the following script from the root level and invoke the functions within an MC?


Code:
//initiate timer paramaters
timerInit = function() {
//getting the time at this point
startTime = getTimer()/1000;
//setting the waiting period
waitFor = 3;
//5 seconds
}

//start the timer
timerPause = function () {
if (waitFor>((getTimer()/1000)-startTime)) {
gotoAndPlay("pause");
} else {
gotoAndPlay("begin");
}
}

[AS2] [CS3] TransitionManager Issue In A Function
Hello,

I am having issues with an error using the TransitionManager, using Flash CS3, ActionScript 2.0 ...here's my error:

The class or interface 'TransitionManager' could not be loaded.

The error is refering to:

var popUpTransitionManager:TransitionManager;

Yes, I have the import statement in my FLA.

I'm using the training book, which comes with complete files. When I play the unaltered, complete files, I don't get the error. However, when I just look at the .as file and do a syntax check, it yells the error at me.

This is the only solid info I found on the matter... the blog post doesn't exactly help, but the second comment addresses AS2. Here's the link:

http://flexion.wordpress.com/2007/06...manager-issue/

Anyone got any ideas on how to fix this OTHER than having to use a tween class? (unless you think the tween class is the BEST solution.)

Thanks, as always,

/*After thought: Why is this happeneing? TransitionManager seems like it's an important part of ActionScript. I'm still learning about this stuff, and I planned on using Transitions in a HUGE upcoming project. Sorry. End rant */

Looping Function Issue
ok my problem is that i want this code to look to see if "race[i] includes the value of query[t]" and to apply the lower code if it is but if it's not then to increment t by 1 and to check again. until it finds a match.

if (race[i].indexOf(querys[t]) != -1) {
whichRace = sportEvent.childNodes[i].childNodes[0].childNodes;
raceName = sportEvent.childNodes[i].attributes.name;
raceLink = sportEvent.childNodes[i].childNodes[0].attributes.couponLink;
raceBox.race.text = raceName;
}
else{t++};

Any help would be very appreciated

Thanks

Path Issue With Function?
Does anyone know how I can take the following script from the root level and invoke the functions within an MC?


Code:
//initiate timer paramaters
timerInit = function() {
//getting the time at this point
startTime = getTimer()/1000;
//setting the waiting period
waitFor = 3;
//5 seconds
}

//start the timer
timerPause = function () {
if (waitFor>((getTimer()/1000)-startTime)) {
gotoAndPlay("pause");
} else {
gotoAndPlay("begin");
}
}

Scoping Issue With A Function
Hi:

Can someone help me with a scoping issue?

SWF A is being loaded into SWF B. Currently, there's a function located in SWF A that is triggered by a user clicking on a movieclip in SWF A. Basically, I am trying to make it trigger from a button in SWF B, instead of triggering by a button in SWF A.

When a user clicks Button B (located on SWF B), I would like it to call the function located in SWF A. This function cause a menu to slide from the left side.

Thanks,
Loren

Timer Function Issue
Hey Guys,

I am working on an mp3 player and have included a timer function. It works fine when the song plays, when paused, when stopped, and when the next button is clicked, all works properly. The problem is that I have a previous button or back button. When I click the back button, my code for the song to go to the previous song works as it shoud but the timer keeps counting. I basicly need to reset the getTime function when that back button is released. Ideas? Here is the script.

Code:

var songTime:Number;
var minutes:Number;
var seconds:Number;
var currTime:String;
var songTimer:Number;

function getTime () {
   songTime = Math.round(s.position/1000);
   minutes = Math.floor(songTime/60);
   seconds = Math.floor(songTime%60);
   if (minutes<1) {
      if (seconds<10) {
         currTime = "0:0"+seconds;
      } else {
         currTime = "0:"+seconds;
      }
   } else if (minutes<10) {
      if (seconds<10) {
         currTime = +minutes+":0"+seconds;
      } else {
         currTime = +minutes+":"+seconds;
      }
   } else {
      if (seconds<10) {
         currTime = minutes+":0"+seconds;
      } else {
         currTime = minutes+":"+seconds;
      }
   }
   time_txt.text = currTime;
}
}

Print() Function Issue....
How can I set the print() function to work so that it prints automatically without bringing up the windows print dialogue?

This will be used for a kiosk that must print at the touch of a flash button.

Wierd Function Call Issue
Can someone explain why this works, when the latter does not?

WORKING:

Code:
Songlist.onLoad = function () {
this=this.firstChild
mainTimeline.output_txt.text=this
songDetails = this.childNodes
this.owner=this.attributes.Owner
...
NOT WORKING:

Code:
Songlist.onLoad = listLoad ()
function listLoad () {
this=this.firstChild
mainTimeline.output_txt.text=this
songDetails = this.childNodes
this.owner=this.attributes.Owner
...

Array Issue (using Random Function)
This is some code for a triva based game. Text is displayed on the screen as questions based on arrays. Line 10 is where I'm having problems. See, I'm trying to make the "question" variable for example "q1" using the random function, so questions will appear random... but line 10 just won't work.
Any ideas?

stop();
_root.mainbox._alpha = 0;
_root.mainboxshad._alpha = 0;
rando=random(2);
question="q"+rando;
q0 = new Array("random question 1:","answer a","answer b","answer c","answer d");
q1 = new Array("The speed of light in a vacuum is:","3.0 x 10 E8 m/s","Very fast","40 km/hr","8000 m/s");
onEnterFrame = function(){
_root.mainbox._alpha += 5;
_root.mainboxshad._alpha += 5;
title.text = (question[0]); //Why isn't the array called here???
opt_1.text = (q1[1]);
opt_2.text = (q1[2]);
opt_3.text = (q1[3]);
opt_4.text = (q1[4]);
}

[F8] MoveClipLoader Issue Inside Function
Hey...Im having a problem here, i cant seem to load a picture inside a function BUT outside the function below all the code it works fine...so obviously im coding something in a stupid way

Here's the code: (the important part is the one commented starting with >>>>>)


Code:
//CREATE:
var myMCLUserProfilePic:MovieClipLoader = new MovieClipLoader();
//------------------------------
trace(userProfile);
//------
myData.load("http://localhost/Test/phpAndMysql/flash%20user%20admin%201.4/login.php");
myData.action = "user_profile_info";
myData.onLoad = function(succes) {
if (succes) {
txtName.text = myData.user_id0;
txtEmail.text = myData.email0;
txtLocation.text = myData.location0;
//tells if the user is connected or not
txtConnected.text = myData.connected;
//>>>>>HERE'S THE PROBLEM...PICTURE ISNT LOADING
var myMCLUserProfilePic:MovieClipLoader = new MovieClipLoader();
myMCLUserProfilePic.loadClip("images/"+userProfile+"_1.jpg", mcPicHolder1);
} else {
trace("Error loading data");
}
myData.user_id = userProfile;
myData.sendAndLoad("http://localhost/Test/phpAndMysql/flash%20user%20admin%201.4/login.php", myData, "POST");
};
If i place this code:


Code:
var myMCLUserProfilePic:MovieClipLoader = new MovieClipLoader();
myMCLUserProfilePic.loadClip("images/"+userProfile+"_1.jpg", mcPicHolder1);
Outside the function...it works fine, (i need this code to work inside the function)

Any ideas ??

Simple Function Calling Issue?
Hello

I'm trying to call a function by constructing the name of that function with a string, like this:


ActionScript Code:
function aboutClose() {
     trace("aboutClose function called");
}

var oldSection:String = 'about';
_root[oldSection+"Close()"];

This doesn't work. I also tried this rather lame attempt to call the function:


ActionScript Code:
var func:String = (oldSection+"Close()");
func;

Is this even possible? Any help greatly appreciated.

Function NextFrame-prevFrame Issue
1 have left arrow and right arrow, to change MC's time line..like

ActionScript Code:
levo.onRollOver = function() {
trace("levo je on");
    var i = _root.container._currentframe;
        _root.container.onEnterFrame = function(){
        _root.container.nextFrame();
        i++;
       trace(i);
        if (i == leftMax){
           delete _root.container.onEnterFrame;
        trace("delete levo");
        }
        }
};
levo.onRollOut = function() {
    delete _root.container.onEnterFrame;
}
levo.onPress = function() {
        var i = _root.container._currentframe;
    i = i +10;
    _root.container.gotoAndStop(i);
}
levo is the instance name of left arrow..this works great....
though...when i press a button which contains a script like this

ActionScript Code:
web.onRelease = function() {
    _root.textMC.loadMovie("web_text.swf"); 
    _root.web_sign.gotoAndStop(1);
    _root.foto_sign.gotoAndStop(2);
    _root.dizajn_sign.gotoAndStop(2);
    _root.container.film_trak._alpha=100;
    _root.frame_yelow._alpha=100;


    }
the firs script does change frame (i trace the frame number) though..the MC dosent realy move to desired frame number created by first script...
am i something missing here?

Issue With Variable Inside A Function
I have a for loop that is adding button functionality to 16 buttons on the stage. It is targeting the button fine with no problem using the var i as the button number. The issue is inside the button function I have another nested button function for the on state of the button which I also use the var i to specify the url number I want associated with the particular button but it is always outputting 17. I don't even understand how it is getting that number. Here is the code.

Code:
function gotoURL(movieNum) {
getURL("javascript:flashURL("+movieNum+");");
}
// ----
for (i=0; i<=16; i++) {
this["b"+i].onRelease = function() {
// -- bring selected button to the top deptht
_root.x += 2;
this.swapDepths(_root.x);
// -- defines last selected button and then delete it
var lastBtn:MovieClip;
this._parent.lastBtn.gotoAndPlay(11);
trace("Button Event One");
this.gotoAndPlay(2);
delete this._parent.lastBtn.onPress;
this._parent.lastBtn = this;
updateAfterEvent();
// -- If the user clicks the on state then it goes to some URL
this.onPress = function() {


_root.gotoURL(i);
trace (i);


trace("Button Event two");
updateAfterEvent();
};
};
}

Issue With LoadMovie And A Returned Value From A Function
Ok, so here's the issue I'm having.

I have a function (that works) that's returning a random clip from an array of clips. I'm trying to take that returned value and place it within a loadMovie statement (that populates 9 clips w/in a container array), but it's not working.

ie. on a button's release:


Code:

on (release){
for (i=0; i<9; i++){
movieReturn = _root.getItem(i);
_root["container"+ i].loadMovie(movieReturn, 0);
}
}
When I put a trace on either movieReturn or _root.getItem(i), I'm seeing the proper value in the output box. When I take movieReturn or _root.getItem(i) out and put one literal value from that array (ie "icon1.swf") it populates my container clips just fine.

My only thought with this, is that since a .swf needs to be in quotes and my value is equal to something like "icon1.swf", etc... that it's unable to load it because it thinks it's a variable or something. I've tried using different methods for converting the value that's returned from my function into a string, but nothing's worked as of yet.

Thanks for the help. =)

Event Function Scope Issue
Hey

I'm more more of an AS 2.0 OO Style guy, and I have a problem that my project has to be written in AS 1.0 MX, so I'm having an issue with function declarations.

All my functions are declared on the first frame, in the following manner:


ActionScript Code:
instanceName_mc.onPress = function() {

But my issue is that when using this method, any object instance that is created *after* these function declarations will be left out of them.

Apparently I have to put all my AS code beside simple stop(); codes within this one section, I initially tried copying the code from the first frame into the second to allow it to loop (without the initialisation) and that weilded some odd results (dragging etc stopped working correctly) anyone have any ideas how I can approach this in actionscript 1.0?

What The? Scope Variable/function Issue?
i'm trying to make a little nav system where the buttons are mcs and are arranged horizontally. when you click on a button it moves to the first position and the button that was originally in the first position switches places with it.

i think i've just about got it and am using a custom function to move the clips. I can't seem to get the first clip to switch places though.

my AS:


Code:
//this is on each mc
on(release){
if(this.newposition!=1){
positionclicked=this._x;
trace(positionclicked);
trace(_root.movieclip1);
_root.movieclip1.flyTo(positionclicked, 178, 2.4, 1);
this.flyTo(145, 178, 2.4,1);
this.newposition=1;
_root.movieclip1="blue";
}
}
the only difference is where I set the _root.movieclip1="blue" which is the instance name of this clip. I change it to be "red" for the red clip, etc.
the variables trace okay but passing the "positionclicked" variable to the flyTo function on movieclip1 doesn't seem to be working...

arrgghhh... am I even doing this the right way ?

here's the function that moves the clips if you're interested (i didn't write it)

Code:
//flyTo prototype created by Brendan Dawes & Andy Beaumont
MovieClip.prototype.flyTo = function(targetX,targetY,startSpeed,precision){

if(this.moveProto.targetX == null){
this.createEmptyMovieClip("moveProto",this.depthCount+1);
++this.depthCount;
};

this.moveProto.targetX = targetX;
this.moveProto.targetY = targetY;
this.moveProto.startSpeed = startSpeed;
this.moveProto.precision = precision;

this.moveProto.onEnterFrame = function(){
if(Math.abs(this._parent._x - targetX) < precision && Math.abs(this._parent._y - targetY) < precision){
this._parent._x = targetX;
this._parent._y = targetY;
removeMovieClip(this);
}

this._parent._x -= (this._parent._x - targetX)/startSpeed;
this._parent._y -= (this._parent._y - targetY)/startSpeed;

}

}
blue.newposition=1;
pink.newposition=2;
orange.newposition=3;
red.newposition=4;
green.newposition=5;

_root.movieclip1="blue";
trace(movieclip1);

stop();

Utilizing Var In Function (scope Issue?)
I'm trying to attach clips based on elements in an array. then when all the clips are attached, i'm using setinterval to have the attached clips slide onto the stage and stop in a row.

for some reason , the name of the dyamically attached clip isn't tracing in my function (the one with interval set).

any ideas anyone?


Code:
stop();

import mx.transitions.Tween;
import mx.transitions.easing.*;

picArray=new Array("f_06hcfdgs_202helm.jpg", "f_06hcsd_radio.jpg", "f_06hcfdgs_231skistorage.jpg", "f_06hcfdgs_231Ttop.jpg" , "f_06hcsd_257floorstorage.jpg", "f_06hcsd_257head.jpg", "f_06hcsd_257rearseat.jpg", "f_06hcsd_257rubrail.jpg", "f_06hcsd_260entcenter.jpg", "f_06hcsd_260helm.jpg", "f_06hcsd_skistorage.jpg", "f_06hcfdgs_231helm.jpg");
//loop thru clips and attach them all to an empty clip off stage
for(i=0; i<picArray.length; i++){
county._global=i;
trace(picArray[i]+" at index number: "+i);
item=startPoint.attachMovie("holder", "holder"+i, i);
//is this neccessary?
item._x=startPoint._x;
item._y=startPoint._y;
item.index=i;
}
//vars to use in function to send clips one at a time
counter = 0;
numItems = picArray.length;
trace(numItems);
myInterval = setInterval(slideClip, 150);
//function to repeat to move each clip
function slideClip(){
//create a var to hold the dynamically attached clip name to pass to Tween
cn="holder" + counter;
moveClip=_root.features.startPoint[cn];
trace(moveClip);
moveClip.index=_root.features.startPoint["holder" + counter].index;
trace(moveClip.index+" this is the index from the attached clip");
//tween, slide the clip over to a position calculated by clip width and index
var theSlide:Tween = new Tween(moveClip, "_x", Elastic.easeOut, moveClip._x, moveClip.index*92, 3, true);
if(counter == numItems) clearInterval(myInterval);
else counter++;

}

slideClip();

What The? Scope Variable/function Issue?
i'm trying to make a little nav system where the buttons are mcs and are arranged horizontally. when you click on a button it moves to the first position and the button that was originally in the first position switches places with it.

i think i've just about got it and am using a custom function to move the clips. I can't seem to get the first clip to switch places though.

my AS:


Code:
//this is on each mc
on(release){
if(this.newposition!=1){
positionclicked=this._x;
trace(positionclicked);
trace(_root.movieclip1);
_root.movieclip1.flyTo(positionclicked, 178, 2.4, 1);
this.flyTo(145, 178, 2.4,1);
this.newposition=1;
_root.movieclip1="blue";
}
}
the only difference is where I set the _root.movieclip1="blue" which is the instance name of this clip. I change it to be "red" for the red clip, etc.
the variables trace okay but passing the "positionclicked" variable to the flyTo function on movieclip1 doesn't seem to be working...

arrgghhh... am I even doing this the right way ?

here's the function that moves the clips if you're interested (i didn't write it)

Code:
//flyTo prototype created by Brendan Dawes & Andy Beaumont
MovieClip.prototype.flyTo = function(targetX,targetY,startSpeed,precision){

if(this.moveProto.targetX == null){
this.createEmptyMovieClip("moveProto",this.depthCount+1);
++this.depthCount;
};

this.moveProto.targetX = targetX;
this.moveProto.targetY = targetY;
this.moveProto.startSpeed = startSpeed;
this.moveProto.precision = precision;

this.moveProto.onEnterFrame = function(){
if(Math.abs(this._parent._x - targetX) < precision && Math.abs(this._parent._y - targetY) < precision){
this._parent._x = targetX;
this._parent._y = targetY;
removeMovieClip(this);
}

this._parent._x -= (this._parent._x - targetX)/startSpeed;
this._parent._y -= (this._parent._y - targetY)/startSpeed;

}

}
blue.newposition=1;
pink.newposition=2;
orange.newposition=3;
red.newposition=4;
green.newposition=5;

_root.movieclip1="blue";
trace(movieclip1);

stop();

Calling Class-function Issue
I have a really strange problem accessing a memberfunction of a class I made.

Essentially, when I create a class-instance just using regular code:

ActionScript Code:
var myClassInstance:myClass = new myClass ();

..I can access memberfunctions without any problem.

But (and here is where it goes crazy), when I write a function that will create this class-instance, and calls it to create an instance, it is impossible for me to access the member-functions.

ActionScript Code:
CreateInstance();
 
function CreateInstance(){
    var myClassInstance:myClass = new myClass ();
}


I mean, it just seems insane that there would be any diffrerence wether I create an instance using a function or not.


Here is the fla-file. In the .as-file there are the two alternatives for creating the instance at load. The button then tries to use the member-function of the class to move the class-instance (which is a movieclip) horisontally.

http://www.kirupaforum.com/forums/at...achmentid=2465

Function Variable Scope Issue
I am loading a jpeg to a mc.(image_mc), and getting the actual size of it
via process_mc.onEnterFrame method. The problem is, when I trace(heg) in the
functional literal, it gives me the actual width, although when I trace it
outside of the literal, it gives me undefined, that I am afraid I am
declarign my variable as local ?, which I tried putting _global.heg but
didn't work out for me

I want to pass the value of the _width to outside of the function

here is my code in 3 different styles, watch for the declaration of the
variable in and outside of the function;

ActionScript Code:
//  this works but I cannot pass the value of the heg outside of the
// function.
 
this.createEmptyMovieClip("process_mc", 0);
this.createEmptyMovieClip("image_mc", 1);
this.image_mc.loadMovie("2.jpg");
 
this.process_mc.onEnterFrame = function() {
 if (this._parent.image_mc.getBytesLoaded() ==
this._parent.image_mc.getBytesTotal()) {
  if (this._parent.image_mc._width>1) {
   heg =image_mc._width
   trace(heg);
 
   delete this.onEnterFrame;
  }
 }
};

/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////

ActionScript Code:
//  this gives me undefined for in the trace, because I am trying to pass
// the value outside of the function.
this.createEmptyMovieClip("process_mc", 0);
this.createEmptyMovieClip("image_mc", 1);
this.image_mc.loadMovie("2.jpg");
 
this.process_mc.onEnterFrame = function() {
 if (this._parent.image_mc.getBytesLoaded() ==
this._parent.image_mc.getBytesTotal()) {
  if (this._parent.image_mc._width>1) {
   heg =image_mc._width
 
 
   delete this.onEnterFrame;
  }
 }
};
   trace(heg);

/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////

ActionScript Code:
// this gives me the value of 0, because I am afraid, the loaded movie
// just shoots in too early and gets me the value 0.
 
this.createEmptyMovieClip("process_mc", 0);
this.createEmptyMovieClip("image_mc", 1);
this.image_mc.loadMovie("2.jpg");
 
this.process_mc.onEnterFrame = function() {
 if (this._parent.image_mc.getBytesLoaded() ==
this._parent.image_mc.getBytesTotal()) {
  if (this._parent.image_mc._width>1) {
 
 
   delete this.onEnterFrame;
  }
 }
};
 heg =image_mc._width
   trace(heg);


thanks in advance.
oz

Function + Dotsyntax OnEnterFrame// Etc Issue
can anyone tell me why this aint working..?
if i use ( example > mc.onEnterFrame = function(){ if(true){this.nextFrame(); }else{ this.prevFrame();}} ) then it works.. but i just wanted to simplyfi' it alittle.. using functions in a little more thought through way..


function hehe() {
_root.infoOne = true;
trace("true")
}
function haha() {
_root.infoOne = false;
trace("false")
}
function hihi() {
if (infoOne) {
trace("nextFrame")
this.nextFrame();
} else {
this.prevFrame();
trace("prevFrame")
}
}
infoB.onRollOver = hehe();
infoB.onRollOut = haha();
infoB.onDragOut = haha();
infoB.onEnterFrame = hihi();

thx infront

Copyright © 2005-08 www.BigResource.com, All rights reserved