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








Adding Action To Button Stops Other Action.


Flash MX.....

I have two frames, there resides on the stage a button with the instance name "blabla".

First frame actionscript is.....

blabla._y = blabla._y + 1;

Second frame actionscript is........

gotoAndPlay(1);

The button slides down the screen when published, that is the desired effect.

Problem..... as soon as I add any actionscript to the button, even just two comment slashes "//", the movement stops.

I have a feeling that there is some really basic concept that is flying over my head at the moment.




FlashKit > Flash Help > Flash ActionScript
Posted on: 09-29-2002, 05:21 AM


View Complete Forum Thread with Replies

Sponsored Links:

Adding An Action To A Button
I want to add an actions layer to a button. I keep getting a message that says "current selection can't have actions applied to it". Why not?

View Replies !    View Related
Adding Rollout Action Scrript To A Button
hi .... i want to play a MovieClip when i rollout on a button ... i know it can only be done by using action script ,,, thanx

View Replies !    View Related
Need Action Script Help For Adding A Hyperlink To A Button
Hey there its been awhile since I've been here, but I came back because I have a simple question that could be answered quickly, but it has been bothering me for quite a while.

I have made a flash button and I have made it that when you press the button it plays a sound sounds way to easy right ? but the thing is though when I press the button I want it to play a sound and take the user to a specified webpage on my site, But I don't know the right action script code to generate or write out to make it work correctly or not at all......

Can someone please look at this code and tell me what I am doing wrong and also that code will be copied to 4 other buttons but will be a little modfied to go to other different webpages on my site.

[on (release) {

//Goto Webpage Behavior
getURL("http://sunflare2000.250free.com/darklightninghacks.htm//","_self");
//End Behavior]

Thanks for any help that you can provide for me
MadMikeXP

View Replies !    View Related
Adding On Button Click Action From Within A Loop?
Hello, I am quite new to as3 and I really cannot figure out how to do this.

This script i made loads all of my images really nicely into my scrollpane
Then when i click on the image it returns:
undefined
[object Loader]

For every image, it has a unique materialID (from my database), so i want to make a textbox this value when i click on an image.

But the eventhandler does not seem to know which image it has clicked! I really don't understand why not, I thought it would store the current value of evt.target.data["Material"+i] when clicked

But it just returns [object Loader], instead of the value of evt.target.data["Material"+i] ("12345", for example)

Is it possible to pass a unique value for each image i load to the clickhandler function? so when i click on an image, the textbox on the scence changes to the name of that image..

Please give any advise..


Code:
var myLoader:URLLoader = new URLLoader()
myLoader.dataFormat = URLLoaderDataFormat.VARIABLES
myLoader.load(new URLRequest("http://www.mydomain.com/materials.php"))
myLoader.addEventListener(Event.COMPLETE, onDataLoad)
myLoader.addEventListener(IOErrorEvent.IO_ERROR, onIOError)
myLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError)
myLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHTTPStatus)

var holder:Sprite = new Sprite();
var p:Array = new Array();
var hor = -100
var ver = 10
var rows = 0
var howmanyloaded = 0
var lasttoload = 0

function onDataLoad(evt:Event){

var thestage = 0.2
var count = evt.target.data.count
lasttoload = count - 2
trace(lasttoload)
var imagetoload = Math.round(lasttoload * thestage)

for(var i:uint=0; i<evt.target.data.count; i++){

p[i] = new Loader();
p[i].load(new URLRequest("http://www.mydomain.com/products/pics/"+evt.target.data["Material"+i]+".jpg"));
//trace(evt.target.data["Material"+i])
//preloading stuff, will work on fixing later today
//p[i].contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
//p[i].contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
holder.addChild(p[i]);

p[i].addEventListener(MouseEvent.CLICK, clickHandler)

//my genius way to avoid having to do the maths. haha
if(rows==4){
rows = 0
hor = -100
ver = ver + 110
} else {
hor = hor + 110
rows++
//ver = ver + 0
}
p[i].x = hor
p[i].y = ver

function clickHandler(event:MouseEvent):void {
trace(evt.target.data["Material"+i]);
trace(event.target);
}


}
}

//error callbacks
function onIOError(evt:IOErrorEvent){
trace("IOError: "+evt.text)
}
function onHTTPStatus(evt:HTTPStatusEvent){
//trace("HTTPStatus: "+evt.status)
}
function onSecurityError(evt:SecurityErrorEvent){
trace("SecurityError: "+evt.text)
}

////i have just temporarily added a timer here, because the scrollpane does not scroll unless i add the mc when it's already filled
//will have to tie this into the preloading, attach mc to pane when it is done preloading.
var timer:Timer = new Timer(7000, 1);
timer.addEventListener(
TimerEvent.TIMER,
function(evt:TimerEvent):void {
pane.source = holder;
trace("attached")
}
);
timer.start();

View Replies !    View Related
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

View Replies !    View Related
Shared Library - Problem Adding Action To Imported Button
hello can anyone help with this quiry please? I have imported a button from one swf into another, and that's fine. Unfortunately when i add an action to the imported button on the stage the action does not work at all. the button is actviated, but the action is completely ignored. help please?!

i have tried messing around with the export settings from the other swf too, but still no joy?!

View Replies !    View Related
One Action Stops Another?
Hi all
This is my first flash website so bare with me! www.sixfeetunder.dk
My problem is that when you use the menu links to see the clothes the bouncing squares stop bouncing??
Is there a way around this? I would like the bouncing squares to keep bouncing true the entire movie
I am gratefull for any help or leads you can give me
I cant upload the flash file because its 388kb zipped
thanks
bmbc

View Replies !    View Related
Frame Action To Call Tell Target (rather Than Button Action)?
I really need a frame to Tell Target a movie clip. For some reason, I can't get a Frame Action to work with Tell Target.

I have no problem applying the same Tell Target to a button, however. Am I missing something? Is Tell Target not meant for Frame Actions?

View Replies !    View Related
Motion Stops Another Action
hi
my problem is that i have some motion applied to a movie which has a menu a few layers above with some mouseOver actions applied. but when i put the motion scipt on the movie in the _root layer it render the mouseover actions a few layers up in the same movie useless. they are both mouseOver actions and i think one is cancelling the other out because there movie within movies.
Im sure this isnt making any sense - not to me anyway!

i have a movie on the _root.
It has the following script applied to it, which i got from this site and works really well - on rollover the menu page rolls out

onClipEvent (load) {
_x = 0;
_y = 0;
div = 5;
}
onClipEvent (enterFrame) {
_x += (endX-_x)/div;
_y += (endY-_y)/div;
_root.nav.onRollOver = function() {
endX = 0;
endY = 0;
_root.nav.onRollOut = function() {
endX = -256;
endY = 0;
};
};
}

within this movie i have another movie with the menu buttons that i want to iincrease in _alpha on rollover - the following code is applied to the movie clip buttons

onClipEvent (load) {
this.onRollOver = function() {
_root.alphas.alpa();
};
this.onRollOut = function() {
_root.alphasa.alpaa();
};
this.onPress = function() {
_root.roi.gotoAndPlay(1);
};
this.onRelease = function() {
};
}


then finally, on the timeline of the _root. i have the following script
var alphas:Object = {
alpa : function () { _root.nav.nav01.bc1._alpha = 100; },
alpb : function () { _root.nav.nav01.bc2._alpha = 100; },
alpc : function () { _root.nav.nav01.bc3._alpha = 100; },
alpd : function () { _root.nav.nav01.bc4._alpha = 100; },
alpe : function () { _root.nav.nav01.bc5._alpha = 100; },
alpf : function () { _root.nav.nav01.bc6._alpha = 100; },
alpg : function () { _root.nav.nav01.bc7._alpha = 100; }
};
var alphasa:Object = {
alpaa : function () { _root.nav.nav01.bc1._alpha = 0; },
alpbb : function () { _root.nav.nav01.bc2._alpha = 0; },
alpcc : function () { _root.nav.nav01.bc3._alpha = 0; },
alpdd : function () { _root.nav.nav01.bc4._alpha = 0; },
alpee : function () { _root.nav.nav01.bc5._alpha = 0; },
alpff : function () { _root.nav.nav01.bc6._alpha = 0; },
alpgg : function () { _root.nav.nav01.bc7._alpha = 0; }
};

if i remove the motion script (1st one listed here) the mouseOver on the menu buttons works fine - but as soon as I reapply the motion script they stop working - think its a layer thing to do with the function Rollover but honestly, im really hurting my head
thank you

View Replies !    View Related
Button Triigers Action Only If Other Action Has Been Performed.
I need to make a button call an action only if another specific action has already been performed.

Here's the scenario:

I've got four MC's, each set up as a button, placed on my main stage and given an instance name.

Each MC has a stop action in the first frame. When the button is clicked the MC will begin to play simply by using this code:

on (release) {play();

Once it's off the screen (or no longer behind a mask I should say), the MC stops at a frame labeled "down" with a simple stop action. A few frames later, I have a frame labeled "up" that when triggered, will cause the mc to start again and the button/graphic that is off the screen will come back on the stage.

This works fine using the code below:

on (release) {play();
_root.associates.gotoAndPlay("up");
_root.services.gotoAndPlay("up");
_root.portfolio.gotoAndPlay("up");
}

However, I dont want the button to trigger any of the gotoAndPlay actions UNLESS the specific button has already been clicked and is off the stage.

I guess the code I am looking for would be something like this:

if_root.associates =("down") then _root.associates.gotoAndPlay("up");

any ideas?

Thanks

View Replies !    View Related
Mouseover Stops Action Loop
I have modified a script found hear on flashkit, this is it:

if (Number(grad)>=360) {
grad = 0;
}
if (Number(grad)<=Number(-360)) {
grad = 0;
}
if (Number(getProperty("/follow/dummy", _x))>180) {
grad = Number(grad)+Number((getProperty("/follow/dummy", _x)-180)/20);
} else {
grad = Number(grad)+Number((getProperty("/follow/dummy", _x)-180)/20);
}
// y=sin(grad)
// -----------------
Pi = 3.14159265358979;
x = 2*Pi*grad/360;
iteration = 10;
iteration = iteration*2;
xpotenz = x;
y = 0;
i = 1;
f = 1;
plusminus = 1;
// calculate
// --------------
while (Number(i)<Number(iteration)) {
y = Number(y)+Number((plusminus*(xpotenz/f)));
f = f*(Number(i)+1)*(Number(i)+2);
i = Number(i)+2;
xpotenz = xpotenz*x*x;
plusminus = plusminus*(-1);
}
// --------------
// optional
if ((Number(y)<0.0000000001) and (Number(y)>Number(-0.0000000001))) {
y = 0;
}
// y=cos(grad)
// -----------------
Pi = 3.14159265358979;
x = 2*Pi*grad/360;
iteration = 20;
iteration = iteration*2;
xpotenz = 1;
z = 0;
i = 1;
f = 1;
plusminus = 1;
// calculate
// --------------
while (Number(i)<Number(iteration)) {
z = Number(z)+Number((plusminus*(xpotenz/f)));
f = f*(i)*(Number(i)+1);
i = Number(i)+2;
xpotenz = xpotenz*x*x;
plusminus = plusminus*(-1);
}
// --------------
// optional
if ((Number(z)<0.0000000001) and (Number(z)>Number(-0.0000000001))) {
z = 0;
}
setProperty ("/info", _y, 120-y*-50);
setProperty ("/info", _x, 150+Number(z*100));
setProperty ("/info", _yscale, 50+Number((Number(y)+1)*80));
setProperty ("/info", _xscale, 50+Number((Number(y)+1)*80));


--------------------------------------------------------
--------------------------------------------------------
I have this working really well. It makes the icon fade into the background depending in the position of the mouse and the other icons (in 3d). I need to make a popup stick to the mouse pointer when you’re over one of the icons. But when I place a button in the info mov and the roll over command takes place it stops the main loop command working for all the icons. Why?
Thanks

View Replies !    View Related
Movie Clip Stops When Doing Another Action
hi

i am working on a website, in which i have this kida "compass" follower... looks very cool, if you move the mouse, it turns... BUT

when i click into the text-scroller that is on the same page, that compass just stops.....


can somebody tell me how.... both clips (compass and smooth scroller are ripped and adjusted.... )


somebody please....
maybe i can send you the fla file?

greetz
melvin

View Replies !    View Related
How Can I Trigger An Action When A Sound Stops?
Hi everyone,

I need to trigger an action when a sound stops playing. I loop the sound once, and when its over I want this to set off other actions, such as stopping a graphic equalizer. How might I do this in Flash 5?

many thanks in advance,

Jeremy Paton

My site is at:
http://www.1-language.com - The ESL Site

View Replies !    View Related
Movieclip With Onrelease Stops Action
I have two movieClips (menu buttons). Inside each is an instance of the same movieClip (the rollover background for the menu items).

I want to make each movieClip gotoAndPlay and different scene. Unfortunately, when I append a onRelease event handler to one of the buttons:

_root.services.onRelease = function() {
gotoAndPlay("services", 1);
}

the embedded movieClip seems to stop playing. Get rid of the onRelease code, and it works fine.

The embedded movieClip code sets the _alpha of a polygon box to 50% when the mouse rolls over it, then gradually brings it back to 100% on a rollOut. When its parent movieClip has a onRelease function, it stops working. I'm not sure if this is relevant, but here is the rollover/rollout code:

onClipEvent (load) {
var fadein = false;
this._alpha = 100;
}

onClipEvent (enterFrame) {
if (fadein and this._alpha < 100) {
this._alpha += 2;
}
if (this._alpha > 99) {
fadein = false;
}
}

on (rollOver) {
this._alpha = 50;
}

on (rollOut) {
fadein = true;
}

Thanks in advance to anyone who might have some insight. I'm completely stumped on this one! I've surfed through the manual, but I'm not even sure what to look for.

Best,
Jason

View Replies !    View Related
Movie Stops W/ No Stop Action
i made a site and i was makeing a preloader on scene1 (site is on scene2) and every thing was working fine till it was done loading and then nothing happend

i deleted all of my preloader layers so it was 1layer and 1blank frame on scene 1. I previewed (not the "slow" preview) my movie and it was just like i had a stop(); on a blank frame

my pause at start is NOT checked
im useing flash 8

do you know is happaning?

thanks

View Replies !    View Related
Action When Cursor Stops Moving
Hi

I have seen flashsites where it seems that menus you have clicked at dissapear when the cursor has not moved for a while, is there anyone that knows how this is done ?

Thanx

View Replies !    View Related
Perform Action When Mouse Stops
OK say you have an mc in the middle of the stage. You move the mouse over it and nothing happens....until the mouse stops moving. When it does an action is performed.

I'm not that great at actionscript so I was wondering if anyone could give me a pointer.

I basically need some script that says: If the mouse is over the active area and moving, do nothing. If the mouse is over the active area and it stops, perform this action.

Thanks

View Replies !    View Related
Movieclip Stops - Without Any Stop() Action Anywhere
Hello,

Sorry, it's long - but interesting. And only the description is long, the problem itself is really a very simple one.

I uploaded the .fla to this URL: http://hasenstein.com/TMP/FLA/

To navigate to the trouble spot - (A) in the *running* application:
- Start it.
- Click Start and wait for the 3s anim to pass.
- Move the mouse over the "System defaults" area and click. A short explanation window pops up with a "Show more" button.
- Click that button.

RESULT: the screen is getting "whiter" and you can see trace actions, numbers 1... somewhere. These trace actions are in every other frame ot the MC that causes the trouble. You SHOULD see numbers 1....8, but I get 1...4 and just now 1...6 only - the stop() action, however, is on the frame that has the trace(8) on it!

I use this.stop() everywhere because I subclassed Movieclip and made the MCs classes of that subclass (the code for this is provided under the above URL too, it's very little). All that does is "capture" all stop or play calls and set an internal variable _isPlaying, but doesn't do anything else, it calls super.stop() (etc.) so it's transparent and not the reason for the observed behavior. I had trace actions in the class methods and none were ever called when I saw the problem, so no stop() is called on the MC! Back to why I use this.stop(): I found if I use stop() the MC-method stop() is not called, it seems the global stop() command is independent of MovieClip.stop() (strange, too, I think I really don't want to exchange places with anyone charged to develop "enterprise level applications" with Actionscript, too many strange side-effects that don't always have explanations)

By the way, it shouldn't run at all, there is a stop() on frame 1!!! If I remove that stop(); I observe the exact same behavior, only that now during jump to the _parent-frame, when this MC is initialized, it runs too - all the way to the trace(8)-action! And it again does not get there when gotoAndPlay(1) is called. VERY VERY VERY strange behavior indeed (I understand that the MC runs without the stop when the containing parent MC gets to the frame where this MC is instantiated, but not why it runs through to the stop action then but not when it's supposed to).


To navigate to the trouble spot - (B) in the .fla:

- After opening it, go to frame 3 (of 3), double click on the stage (the MC to go into fills it 100%).
- Then goto frame 69 (the first one with an "a" in the AS layer after frame 1), label "general" for this frame (on layer "AS", my actionscript layer, the topmost one).
- double click somewhere on the stage (again the MC in question is 100% screen filling), to enter mc "general1_1_demo" (instance of general1_1 MC")

This MC is started by a button action of Scene 1 -> Options Dialog -> general1 1 (there: button "Show more", the only one there, in "window" (it's a painted one) "System Defaults") with "_parent.general1_1_demo.gotoAndPlay(1);"

how all of this works (just FYI): the button on(release) action also calls a function that starts loading an flv into an FLV-player (standard component). That flv has cue points. Those cue points trigger - via the cue point event listener function in main.as (provided under the URL above) - gotoAndPlay()-jumps to the labelled frames. The labels to jump to are stored in the cue point parameters. This makes exchanging audio and even altering the presentation by changing the order of sections a matter of changing the audio-file (I have no video-stream in the .flv). I don't provide an .flv here, because it's not necessary for testing my problem, but if you'd like to see a fully functioning version of this stuff have a look at http://letexa.com/courses/7/ (now also somewhere on http://open-xchange.com/) or on the other (few) examples on that (fresh) website.

Have fun and thanks (for taking the time to read this, even more so if you start thinking about the problem!),
Michael

View Replies !    View Related
Action After User Stops Typing
hey I am trying to write this code where it watches a user typing in a text box and then once the user has finished typing it does a certain action. I was thinking maybe run a timer after every keypress and if the user does not press a key within 2 seconds of the last one it exicutes the action. If any of you have a more efficient way of doing this please post it. Anyways what I have so far is


ActionScript Code:
this.onKeyDown = function() {        function doneDelay(){        loadVariablesNum("write.php", 0, "POST");        clearInterval(delay);        }        delay = setInterval(doneDelay, 2000);        }Key.addListener(this);


this works somewhat but it exciutes continuouly after the user stops typing

View Replies !    View Related
Action After User Stops Typing
hey I am trying to write this code where it watches a user typing in a text box and then once the user has finished typing it does a certain action. I was thinking maybe run a timer after every keypress and if the user does not press a key within 2 seconds of the last one it exicutes the action. If any of you have a more efficient way of doing this please post it. Anyways what I have so far is


ActionScript Code:
this.onKeyDown = function() {        function doneDelay(){        loadVariablesNum("write.php", 0, "POST");        clearInterval(delay);        }        delay = setInterval(doneDelay, 2000);        }Key.addListener(this);


this works somewhat but it exciutes continuouly after the user stops typing

View Replies !    View Related
Stop-action Stops Loading Layers As Well?
First time that I work with scenes. Therefore I needed to add a stop-action on the one and only frame of scene1.

Scene1 contains several layers.

When I watch this flashmovie on the internet, the movie appears blanc!

It doesn't matter if I put the action-layer with the stop-action in the upper or lower layer of scene1, or I change the load-order (in the publish-settings) to bottom-up or top-down.

When I preview the movie using test movie or debug movie, all layers are visible. Only on the internet things go different and I see the movie white (its background color).

HELP!!!

View Replies !    View Related
Invoke Action After Movie Clip Stops?
there is one movie clip on my stage with instance name : "myMC"
i have also 2 buttons: "buttonA" and "buttonB"

i have this code on my first frame:

friction = "0.2";
dif = 0;
targety = 0;
_root.onEnterFrame = function (){
dify = dif - myMC._y;
speedy = dify*friction;
myMC._y = Math.floor(myMC._y+speedy);
dify = int(targety)-myMC._y;
}

this code moves "myMC" up and down depends on value of variables: dif and targety,

actions on the buttons:

on buttonA:
on(release){
dif = 370;
targety = 370;
}

on buttonB:
on(release){
dif = 100;
targety = 100;
}

question: i want to invoke some action but only when myMC will stop,
i'd love to change this code to basically specify final position of myMC by assigning final _y value to the buttons (and than say: if (myMc._y == 100){ do this })
but as long as when i place myMC on postion 0,0 and after pressing buttonB it stops
on 100,0 that after pressing buttonA myMC stops on 366,0 and when i keep adding buttons
final position is not the same every time.

please help.

kooba

View Replies !    View Related
Action Script Question: Where Is The OnRelease Action In The Action Folders
I’m working on a project and I trying to make it when you click down on a button that click will send you to a point in the movie and then a symbol will play from there. I know that you need to pick the key with the button on it in the time line and then I know you need to pick the button that you would like to assign the GoToAndPlay statement on.

But what’s really messing with me is where in the heck the on release or the on mouse down statement is in the little action a book when are looking in the action window.

Any help would be much appreciated.

View Replies !    View Related
Action Script Question: Where Is The OnRelease Action In The Action Folders
I’m working on a project and I trying to make it when you click down on a button that click will send you to a point in the movie and then a symbol will play from there. I know that you need to pick the key with the button on it in the time line and then I know you need to pick the button that you would like to assign the GoToAndPlay statement on.

But what’s really messing with me is where in the heck the on release or the on mouse down statement is in the little action a book when are looking in the action window.

Any help would be much appreciated.

View Replies !    View Related
Action Script Question: Where Is The OnRelease Action In The Action Folders
I’m working on a project and I trying to make it when you click down on a button that click will send you to a point in the movie and then a symbol will play from there. I know that you need to pick the key with the button on it in the time line and then I know you need to pick the button that you would like to assign the GoToAndPlay statement on.

But what’s really messing with me is where in the heck the on release or the on mouse down statement is in the little action a book when are looking in the action window.

Any help would be much appreciated.

View Replies !    View Related
Action Script Question: Where Is The OnRelease Action In The Action Folders
Action Script Question: where is the OnRelease action in the action folders

I’m working on a project and I trying to make it when you click down on a button that click will send you to a point in the movie and then a symbol will play from there. I know that you need to pick the key with the button on it in the time line and then I know you need to pick the button that you would like to assign the GoToAndPlay statement on.

But what’s really messing with me is where in the heck the on release or the on mouse down statement is in the little action a book when are looking in the action window.

Any help would be much appreciated.

View Replies !    View Related
How Do I Stop The Movie Clip When The Song Stops With Action Script
Ok...I need help with this....I was given a task to stop a banner when the song that is just about 9:00 mins long. Now i dont know whether or not I should stream it or find some ActionScript for this....The only thing about the streaming is that the banner is about 30 secs. Is there a way for me to loop it until the song end???

Check it out here http://www.syn3.org/myspace/mergeMyspaceAD.swf

It keeps playing after the song ends

View Replies !    View Related
Where Action Fits Into Button That Has Already Some Action?
i've got this code in one of the buttons, but i want the button to be link to the 2nd frame or scene, but do't know where should fit that peiece of code

onClipEvent (enterFrame) // this action already is in main timelin
{
_y = _root.menu4._y
}

something like go(release... should it be after, b4 or within the brackets?

thanks

View Replies !    View Related
Adding Action To Buttons?
Ok, I found a cool tutorial on adding actions to buttons but its for Flash 4, and Im using flsh 5 so its confusing. I just want that when you mouse over the button, a little box or something goes around it, and then when you click on it, it takes you to the url. Can someone please explain to me in really easy terms for a very new newbie how to do this? Thanks.

View Replies !    View Related
Adding .jpg With Action Script
I want to load a jpeg into an instance of a movie clip. I looked in the tutorials and found this: function previousSlide (firstSlide,lastSlide,slideName,slideText) {
i = i-1;
newSlide = slideHolder.loadMovie(slideName + i + ".jpg");
newText = loadVariablesNum(slideText + i + ".txt", 0);

_root.newSlide;
_root.newText;
}


I have tried this over and over using my code and can not get it to work. My code is pic.loadMovie("ur3.jpg");
I have an instance of a blank movie clip named pic on the main timeline. If I change the name of the file called I recieve Error opening URL "file:///C|/Documents%20and%20Settings/bcunningham/Desktop/documents/TRANSFER/pictures/ur.jpg"

So I know it enters the loadMovie because I do not get that when I have an actual file named ur3.jpg in the correct directory. Any help would be greatly appreciated.

View Replies !    View Related
Adding Sound To An Action
I'm using Flash 5.

What I want to do is add sound to an action, an example listed below.

if(mMon==24){
Play this sound
}
if(mMon==43){
Play another sound
}
if(mMon==88){
Play another sound
}

What code do I need to use to make it work? Sounds are *.wav files.

Any help would be great.

Thanks

View Replies !    View Related
Adding A PHP Tag To The GetURL Action?
Hello, you all. I have a question for all you action-script guru’s because I do not have a clue!

The Marketing dept. here at work have decided they need track clicks from webmasters having unique ID numbers from the existing Flash nav. Say that a surfer arrives at a page from an address such as:

http://www.somesite.com/index.html?revid=1014

To include this extension to a normal HTML anchor tag, it would look like so:

<A HREF="join.html<? revid(); ?>"onClick="exit=false"></A>

Originally, one of the Flash nav links simply stated;

on (release) {
getURL("join.html");
}

Including this to my existing Flash navigation via the getURL action, I learned is a different story! The output window shows errors up-the-yang.

on (release) {
getURL("join.html<? revid(); ?>, onClick=exit=false");
}

This did not work too well!

So, the questions are…where does one include this nested PHP tag in the actionScript? Also, where…and how to include the exit pop-up script, "onClick="exit=false?"

Could someone PLEASE school me?

Thank you so much!

Dorian~

View Replies !    View Related
Adding Conditional Action
I have created a telephone keypad in a learning module for users to practice calling our hospital emergency number, ext. 5555.

With rollover the #5 highlights to red.

Upon release I have added a wave file for the sound of the #5 on a touch tone keypad.

Now I would like to add a script that once they have clicked on the number 5 four times, applause or some exclamation of success will play. I want this to only occur if they actually dial the full extension.

I am struggling with the code. Any suggestions? I am using MX 2004.

Thanks.

View Replies !    View Related
Adding Action To XML Menu
Hello,

I was wondering if anybody would be kind enough to assist me with my actionscript problems. I have acquired a component XML Menu from a site and a tutorial on preloading and transitioning dynamic files. The problem that I am having is that I have no idea on how to link these two items. On the tutorial page, they tell me to make an actions layer and add the following code:

code: b1.onRelease = function() {
if (_root.section != "profile.swf") {
_root.section = "profile.swf";
_root.transition.gotoAndPlay("closing");
}
};
b2.onRelease = function() {
if (_root.section != "gallery.swf") {
_root.section = "gallery.swf";
_root.transition.gotoAndPlay("closing");
}
};
b3.onRelease = function() {
if (_root.section != "photos.swf") {
_root.section = "photos.swf";
_root.transition.gotoAndPlay("closing");
}
};

That code obviusly is for the basic buttons on the tutorial but I what I need is for the tutorial's loading and transitioning to be triggered by the XML Menu.

Here is the code for the XML menu (theres more but I believe this is the only relevant part):

code: //--------------------------------------------------
#initclip 1
CollapseButtonClass = ProtoLinkClass();
CollapseButtonClass.inheritFrom(MovieClip);
Object.registerClass("CollapseButton", CollapseButtonClass);
CollapseButtonClass.prototype.init = function() {
if (!this.alpha) {
this.alpha = {start:0, top:100, bottom:0};
}
this.yinactive = this._y;
this.y = this.yinactive;
this.bgObjParams = {width:this.parent._width_, height:this.parent._height_, colourthis.butType == 'secondary') ? (this.parent.sColour) : (this.parent.pColour), alpha:this.alpha.top, resize:false, applyColour:true};
this.txtObjParams = {x:1, y:1, w:this.parent._width_ - 20, h:this.parent._height_ - 0, applyBground:false, applyFocus:true, title:String(this._name), applyIndentthis.butType == 'secondary') ? (true) : (false)};
this.id = this.attachMovie("Rectangle", "bg", 1, this.bgObjParams);
this.id = this.attachMovie("TextBox", "txt", 2, this.txtObjParams);
this.active = false;
this.enabled = true;
};
CollapseButtonClass.prototype.onSignal = function() {
if (this.enabled) {
if (!this.active) {
this.butType == 'secondary' ? this.bg.setColour(this.parent.sColour) : this.bg.setColour(this.parent.pColour);
var newOpacity = Mouse.isWithin(this, true) ? this.alpha.top : this.alpha.bottom;
this.bg._alpha = Math.approach(this.bg._alpha, newOpacity);
} else {
this.bg.setColour(this.parent.aColour);
}
if (this._y <> this.y) {
this._y = Math.approach(this._y, this.y);
}
}
};
CollapseButtonClass.prototype.onMouseUp = function() {
if (Mouse.isWithin(this, true)) {
this.parent.sID.playSound(this.butType);
if (this.butType == 'primary') {
this.parent.activateObj(this.uid);
if (this.butAction != null) {
trace("Action specified in XML: " + this.butAction);
}
} else if (this.butType == 'secondary') {
trace("Action specified in XML: " + this.butAction);
}
}
};
#endinitclip
//==================================================


I am not sure if it will be helpful but, here is the sample XML file:


Quote:




<menu>

<item name="Menu1" action="loadClip">

</item>

<item name="Menu2" action="loadClip">

<sub name="SubMenu1" action="loadClip"></sub>

<sub name="SubMenu2" action="loadClip"></sub>

</item>

<item name="Menu3" action="loadClip">

<sub name="SubMenu3" action="loadClip"></sub>

<sub name="SubMenu4" action="loadClip"></sub>

<sub name="SubMenu5" action="loadClip"></sub>

<sub name="SubMenu6" action="loadClip"></sub>

<sub name="SubMenu7" action="loadClip"></sub>

</item>

<item name="Menu4" action="loadClip">

<sub name="SubMenu8" action="loadClip"></sub>

<sub name="SubMenu9" action="loadClip"></sub>

</item>

<item name="Menu5" action="loadClip">

</item>

<item name="Menu6" action="loadClip">

</item>

</menu>






Thanks in advance to anybody willing to help.

View Replies !    View Related
Adding Action To Combo Box
hi,

is it possible to add actions to combox box values?

for eg.
when i choose "Option 1" --> gotoAndPlay (20);
when i choose "Option 2" --> gotoAndPlay (25);
when i choose "Option 3" --> this.selection.gotoAndPlay (1);

so that it act like a drop down menu....

i really appreciate the help anybody can rendered.

thanks a million.

View Replies !    View Related
[F8] Help Adding An Action To A For Loop
Ive been trying to figure this out for hours and it is driving me crazy. I need to add a different gotoAndPlay action to each instance of 'a'. I can figure out how to add the same gotoAndPlay action to each one but how to I add a different action to each? Any help would be much appreciated.


code:

_global.t_depth = 1;
t_mcs = [t_ele, t_u, t_c, t_a, t_s, t_m, t_o, t_t, t_t2, t_t2b, t_a2];
for (a=0; a<t_mcs.length; a++) {
t_mcs[a].scaleTo(50, 1, "easeOutElastic");
t_mcs[a].onRollOver = function() {
this.scaleTo(100, 0.5, "easeOutElastic");
t_depth += 1;
this.swapDepths(t_depth);
};
t_mcs[a].onRelease = function() {
variable = t_mcs[a];
_root.gotoAndPlay("variable");
};
t_mcs[a].onRollOut = t_mcs[a].onReleaseOutside=function () {
this.scaleTo(50, 1, "easeOutElastic");
};

}

View Replies !    View Related
Adding Action To Buttons
can someone help me i keep getting

1120: Access of undefined property aboutus. aboutus.addEventListener(MouseEvent.CLICK, buttonClickHandler);

can someone please help me

View Replies !    View Related
Adding Action To MC From Within Class
Hi all,

I've got a problem with an actionscript class - basically within the class I attach a movie clip, to which I need to add an onRelease action. I've added a trace action in the code below (see the red lines), but what I really need to do is pass it a property of the class (namely the target...) which I know is out of scope... but there must be some way to pass it... Help, I'm going nuts here... I tried setting the action from outside ie.
preview1.myMC.onRelease = function(){
trace(preview1.myTarget);
}
which doesn't work at all.

Is there any way of passing a reference to the object? I tried completely rewriting the code, associating the class IconPreview with the preview movie clip in the library and instantiating it by attaching movie instead of declaring a new class, but then I had other weird problems, like the setInterval not firing for a start, and trying to apply the action to the whole IconPreview object didn't work either.

I'm completely out of patience with this. Any help *greatly* appreciated...


The bones of the code is this:
/****************** preview class ****************/
class IconPreview{
// declare variables
private var iconImage:String;//the image for the preview
private var order:Number;//page one, page two etc.
private var double:Boolean;//double page or single
private var isOn:Boolean;//whether its' the current preview
static var container:MovieClip;//containing element
static var spacing:Number; //space between one preview and another
public var myMC:MovieClip;
private var t;//interval
private var imageLoaded:Boolean;
public var myTarget:String;

// constructor
function IconPreview(piconImage:String, porder:Number, pdouble:Boolean, pmyTarget:String){
this.iconImage = piconImage;
this.order = porder;
this.double = pdouble;
this.myTarget = pmyTarget;
this.isOn = false;//all switched off at start
container = _root.previewContainer;
spacing = 5;
this.myMC = _root.previewContainer.attachMovie("preview", ["preview"+this.order], _root.previewContainer.getNextHighestDepth());
this.t = null;
this.imageLoaded = false;
this.createClip();
}

function createClip(){
this.myMC._alpha = 0;
this.myMC.loadMovie(iconImage);
this.t = setInterval(this, "positionMC", 500);
}


// position the mc
function positionMC(){
if(this.myMC._height!=0){//not loaded
this.imageLoaded = true;
this._height = myMC._height;
this._width = myMC._width;
clearInterval(this.t);
var yPos = spacing;
yPos += ((myMC._height + spacing)*(this.order-1));
var xPos = (container._width - this.myMC._width)/2;
this.myMC._x = xPos;
this.myMC._y = yPos;
this._x = myMC._x;
this._y = myMC._y;
//set actions - have to use function literals
//as the MC hasn't got access to methods of the class

//fade up
this.myMC.onEnterFrame = function(){
if(this._alpha < 100){
this._alpha +=5;
}else{
this.onEnterFrame = null;//clear action
}
trace(this._alpha);
}

this.myMC.onRelease = function(){
trace("hello - released");
}

}
}


}

View Replies !    View Related
Adding A Frame Action
I have just started using Adobe Flash, having used Macromedia Flash for some time to do simple animations/movies. I have been trying to add a simple Frame Action to a keyframe which in Macromedia Flash simply required clicking on the keyframe required and going into Actions from the menu bar. From here, you simply clicked on the plus sign to add an action and then I selected the Movie Control>Stop action. This then gave me a symbol at the frame I wanted to indicate the action.


This simple action does not seem to be the same procedure in Adobe Flash, when I go into actions and click on the plus sign it brings up a whole list of actions that are not relevant to what I am wanting. Can anyone tell me how I simply add the action to stop an action during a movie, which as noted above is simply Movie Control>Stop action in Macromedia Flash.

Any help appreciated.
Michelle

View Replies !    View Related
Adding Some Action To The Buttons
Hi!

i got a video online with a preloader. It's made simply and looks like that:

loader.autoLoad = false;
loader.contentPath = "videoname.swf";
pBar.source = loader;
loader.load();

pBar.complete = function() {
this._visible = false;
};

now i want to add some buttons to "jump" to specific frames. I add some buttons and add actionscript like that:

on (click) {

this._parent.gotoAndPlay("250");

}

hmmm, but it doesn't work. how can i specify the name of the video? i think that the problem is, he doesn't know this._parent

Somebody an idea?

Thx,
Dorian

View Replies !    View Related
Adding Action To XML Menu
Hello,

I was wondering if anybody would be kind enough to assist me with my actionscript problems. I have acquired a component XML Menu from a site and a tutorial on preloading and transitioning dynamic files. The problem that I am having is that I have no idea on how to link these two items. On the tutorial page, they tell me to make an actions layer and add the following code:

ActionScript Code:
b1.onRelease = function() {
if (_root.section != "profile.swf") {
_root.section = "profile.swf";
_root.transition.gotoAndPlay("closing");
}
};
b2.onRelease = function() {
if (_root.section != "gallery.swf") {
_root.section = "gallery.swf";
_root.transition.gotoAndPlay("closing");
}
};
b3.onRelease = function() {
if (_root.section != "photos.swf") {
_root.section = "photos.swf";
_root.transition.gotoAndPlay("closing");
}
};




That code obviusly is for the basic buttons on the tutorial but I what I need is for the tutorial's loading and transitioning to be triggered by the XML Menu.

Here is the code for the XML menu (theres more but I believe this is the only relevant part):

ActionScript Code:
//--------------------------------------------------
#initclip 1
CollapseButtonClass = ProtoLinkClass();
CollapseButtonClass.inheritFrom(MovieClip);
Object.registerClass("CollapseButton", CollapseButtonClass);
CollapseButtonClass.prototype.init = function() {
if (!this.alpha) {
this.alpha = {start:0, top:100, bottom:0};
}
this.yinactive = this._y;
this.y = this.yinactive;
this.bgObjParams = {width:this.parent._width_, height:this.parent._height_, colour:(this.butType == 'secondary') ? (this.parent.sColour) : (this.parent.pColour), alpha:this.alpha.top, resize:false, applyColour:true};
this.txtObjParams = {x:1, y:1, w:this.parent._width_ - 20, h:this.parent._height_ - 0, applyBground:false, applyFocus:true, title:String(this._name), applyIndent:(this.butType == 'secondary') ? (true) : (false)};
this.id = this.attachMovie("Rectangle", "bg", 1, this.bgObjParams);
this.id = this.attachMovie("TextBox", "txt", 2, this.txtObjParams);
this.active = false;
this.enabled = true;
};
CollapseButtonClass.prototype.onSignal = function() {
if (this.enabled) {
if (!this.active) {
this.butType == 'secondary' ? this.bg.setColour(this.parent.sColour) : this.bg.setColour(this.parent.pColour);
var newOpacity = Mouse.isWithin(this, true) ? this.alpha.top : this.alpha.bottom;
this.bg._alpha = Math.approach(this.bg._alpha, newOpacity);
} else {
this.bg.setColour(this.parent.aColour);
}
if (this._y <> this.y) {
this._y = Math.approach(this._y, this.y);
}
}
};
CollapseButtonClass.prototype.onMouseUp = function() {
if (Mouse.isWithin(this, true)) {
this.parent.sID.playSound(this.butType);
if (this.butType == 'primary') {
this.parent.activateObj(this.uid);
if (this.butAction != null) {
trace("Action specified in XML: " + this.butAction);
}
} else if (this.butType == 'secondary') {
trace("Action specified in XML: " + this.butAction);
}
}
};
#endinitclip
//==================================================





I am not sure if it will be helpful but, here is the sample XML file:


Quote:




<menu>

<item name="Menu1" action="loadClip">

</item>

<item name="Menu2" action="loadClip">

<sub name="SubMenu1" action="loadClip"></sub>

<sub name="SubMenu2" action="loadClip"></sub>

</item>

<item name="Menu3" action="loadClip">

<sub name="SubMenu3" action="loadClip"></sub>

<sub name="SubMenu4" action="loadClip"></sub>

<sub name="SubMenu5" action="loadClip"></sub>

<sub name="SubMenu6" action="loadClip"></sub>

<sub name="SubMenu7" action="loadClip"></sub>

</item>

<item name="Menu4" action="loadClip">

<sub name="SubMenu8" action="loadClip"></sub>

<sub name="SubMenu9" action="loadClip"></sub>

</item>

<item name="Menu5" action="loadClip">

</item>

<item name="Menu6" action="loadClip">

</item>

</menu>




Thanks in advance to anybody willing to help.

View Replies !    View Related
Adding Some Action To The Buttons
Hi!

i got a video online with a preloader. It's made simply and looks like that:

loader.autoLoad = false;
loader.contentPath = "videoname.swf";
pBar.source = loader;
loader.load();

pBar.complete = function() {
this._visible = false;
};

now i want to add some buttons to "jump" to specific frames. I add some buttons and add actionscript like that:

on (click) {

this._parent.gotoAndPlay("250");

}

hmmm, but it doesn't work. how can i specify the name of the video? i think that the problem is, he doesn't know this._parent

Somebody an idea?

Thx,
Dorian

View Replies !    View Related
Adding A PHP Tag To The GetURL Action?
Hello, you all. I have a question for all you action-script guru’s because I do not have a clue!

The Marketing dept. here at work have decided they need track clicks from webmasters having unique ID numbers. Whereas a normal HTML anchor tag would contain this line;

<A HREF="join.html<? revid(); ?>"onClick="exit=false"></A>

Originally, one of the Flash nav links simply stated;

on (release) {
getURL("join.html");
}

Including this to my existing Flash navigation via the getURL action, I learned is a different story! The output window shows errors up-the-yang.

on (release) {
getURL("join.html<? revid(); ?>, onClick=exit=false");
}

This did not work too well!

So, the questions are…where does one include this nested PHP tag in the actionScript? Also, where…and how to include the exit pop-up script, "onClick="exit=false?"

Could someone PLEASE school me?

Thank you so much!

Dorian~

View Replies !    View Related
Adding A Simple Action To Object (CS3)
Hello,
For frame of reference.. I havent used Flashe since before Studio 8, I just got Adobe Flash CS3.

All I want to do is create an object that when clicked on will GoTo a new Frame in the Scene.

I set this up the way I used to in older Flash versions, and when i click on the object to set an Action I get an error saying: "Current Selection Can Not Have Actions Applied to it"

Have they completely changed the way this works?

Any tutorials or sample FLAs on creating a simple On Press GoTo Frame would be great!

thanks

View Replies !    View Related
Adding Action To Dynamic Menu
Hello all,

I've asked about this piece of actionscript before and gotten very good help. I'm pretty close to understanding what happens. I can see how the menu is setup and all. There is just one thing I don't see yet.

Where in this script are the actions attached to the menu-items. I can't seem to figure that out. Can anybody else see it?

Dynamic List
Initial Setup (Don’t Change)

function setUpList() {
with (mcList) {
with (mcListTitle) {
txtListTitle.text = itemsA.listTitle;
txtListTitle.autoSize = true;
bigW = _width;
}
with (mcPart0) {
mcListText.txtItem.text = itemsA[0].labelText;
mcListText.txtItem.autoSize = true;
lastY = _y;
}
myDepthM = 5;
intY = _y;
intW = mcListBG._width;
intHeight = mcListBG._height;
if (mcListTitle._width>mcPart0._width) {
bigW = mcListTitle._width;
} else {
bigW = mcPart0._width;
}
}
buildList();
}

Distance Between Menu Items



////// **** change number to how many pixels you want between menu items
////// **** default is 25
ySpace = 20;
//////////////////////////////////////////////////////////////////////
////////////////////// MENU BUILD (DON'T CHANGE) ///////////////////
function buildList() {
for (i=1; i<itemsA.length; i++) {
duplicateMovieClip(mcList.mcPart0, "mcPart"+i, myDepthM++);
with (mcList["mcPart"+i]) {
_y = lastY+ySpace;
mcListText.txtItem.text = itemsA[i].labelText;
mcListText.txtItem.autoSize = true;
lastY = _y;
myW = _width;
}
if (myW>bigW) {
bigW = myW;
}
}
with (mcList) {
topHeight = mcListTop._height;
mcListTop._width = bigW+40;
with (mcListBG) {
_width = bigW+40;
_height = lastY;
bgHeight = _height;
}
with (mcListBGBottom) {
_y = bgHeight+topHeight-3;
mcRect._width = bigW+40-(mcCornerL._width*2);
mcCornerR._x = mcRect._width+(mcCornerL._width*2);
}
_x = _x-(bigW-intW);
}
listButtons();
}

Menu List Buttons Code

**** minNameLength = mcPart0 length
minLNameLength = 7;
animNum = 0;
function listButtons() {
for (i=0; i<itemsA.length; i++) {
mcList["mcPart"+i].onRelease = function() {
if (goToView != 99) {
myLastClickedNum = myClickedNum;
}
clicked = 0;
for (j=0; j<=2; j++) {
mcPopUp["mcPart"+j].gotoAndStop(1);
}
mcPopUp["mcPart"+clicked].gotoAndStop(2);
nLLength = this._name.length;
getLNum(this._name);
myClickedNum = myLNum;
trace(myLastClickedNum+"myLastClickedNum 1");
trace(myClickedNum+"myClickedNum 1");
listClicked(myClickedNum);
};
mcList["mcPart"+i].onRollOver = function() {
nLLength = this._name.length;
getLNum(this._name);
mcList["mcPart"+myLNum].gotoAndStop(2);
};
mcList["mcPart"+i].onRollOut = function() {
nLLength = this._name.length;
getLNum(this._name);
for (j=0; j<=itemsA.length; j++) {
if (j != myClickedNum) {
mcList["mcPart"+j].gotoAndStop(1);
}
}
};
}
}
function getLNum(which) {
if (nLLength == minLNameLength) {
myLNum = mcList[which]._name.substring(nLLength-1, nLLength);
} else {
myLNum = mcList[which]._name.substring(nLLength-2, nLLength);
}
return (myLNum);
}

View Replies !    View Related
Adding Action To Buttons On Navigation Bar
I have a flash template, the fla and the swf. I want to edit the buttons to point to the correct pages. I have cllicked on the buttons and did an edit, then in the action pointed the the index.html made it the _parent, locked the button. My problem is it is not going to the index page.

Is there something else I need to do? I am using Flash 8 and when I check the properties for the action script if is 1.0. When I change it to 2.0 I get the following error:

encountered
getURL(/:url6);

Total ActionScript Errors: 6 Reported Errors: 6

Please help.

Thank you
Dee

View Replies !    View Related
Adding Action Script To Instances...
I'm pretty frustrated and am done searching the site. Awful...just awful. Anyway...

Using Flash CS3 for the first time since upgrading. I'm not able to add action script to instances. Certainly this isn't a change. I've created a button symbol. I've named the instance upon dragging it on the stage. Now it tells me I can't apply actions to it.

I hope I'm just missing a step.

View Replies !    View Related
Adding GetURL Makes Dissappear Action Not Run
Hi,

I am using Flash MX 2004 and I have a button that has the following action on it:

on (rollOver) {
gotoAndPlay(2);
}
on (rollOut) {
gotoAndPlay(16);
}
on (release) {
_root.gotoAndPlay("dissappear");
}

When I try to link to the URL by using:


getURL("a_About.htm", "_self");

so it looks like:

on (release) {
_root.gotoAndPlay("dissappear"),
getURL("index.htm", "_self");
}

The "dissappear" action (makes the button move right, left and fade out) doesn't happen even though the button goes to the right page. I want to keep the dissappear action and then go to the URL... I have tried every combination that I can think of (getURL before that action, after the action, within the action....) and nothing works. It keeps on linking immeadiately to the page but the disappear action is completely skipped.

Could anyone please point me in the right direction?

Thanks, MC

View Replies !    View Related
Need Some Help With Adding Action Script This Is Not A Noob Questioin
Well guys As you can read i want to add actionscript to movieclips newle made ones if anyone can help me out like adding.

onClipEvent(load){

}

to new movie clip named

new_mc_1 without going into actions in flash cuz im trying to do this in .as files cuz i sorta have to. dont ask wy just can someone help me? please.

View Replies !    View Related
[F8] Adding Layers Over XML Photo Slideshow Action
I found some actionscript that I was able to use to create an xml photo slideshow. The problem is when I try to add another movie clip to use as texture above the photo's, it only works on the first frame and fades out.
It seems like once it sees the action to create the movie clips it ignores everything else in the timeline.

I have this action in the first frame on the first layer:

PHP Code:




// set random # variables - each must be 0 for first 'while' loop below
var randomNum = 0;
var randomNumLast = 0;

// parent container
var container_mc = this.createEmptyMovieClip("container",0);
// movie clip containers
container_mc.createEmptyMovieClip("loader1_mc",2);
container_mc.createEmptyMovieClip("loader2_mc",1);

// preload watcher
this.createEmptyMovieClip("watcher_mc",100);

// load xml
images_xml = new XML();
images_xml.ignoreWhite=true;
images_xml.onLoad = parse;
images_xml.load("images.xml");

function parse(success) {
    if (success) {
        imageArray = new Array();
        var root = this.firstChild;
        _global.numPause = Number(this.firstChild.attributes.timer * 1000);
        _global.order = this.firstChild.attributes.order;
        _global.looping = this.firstChild.attributes.looping;
        _global.fadetime = Number(this.firstChild.attributes.fadetime);
        _global.xpos = Number(this.firstChild.attributes.xpos);
        _global.ypos = Number(this.firstChild.attributes.ypos);
        var imageNode = root.lastChild;
        var s=0;
        while (imageNode.nodeName != null) {
            imageData = new Object;
            imageData.path = imageNode.attributes.path;
            imageArray[s]=imageData;
            imageNode = imageNode.previousSibling;
            s++;
        }
        // place parent container
        container_mc._x = _global.xpos;
        container_mc._y = _global.ypos;
        // parse array
        imageArray.reverse();
        imageGen(imageArray);
    } else {
        trace('problem');
    }
}

// depth swapping
function swapPlace(clip,num) {
    eval(clip).swapDepths(eval("container_mc.loader"+num+"_mc"));
}

function loadImages(data,num) {
    if (i==undefined || i == 2) {
        i=2;
        createLoader(i,data,num);
        i=1;
    } else if (i==1) {
        createLoader(i,data,num);
        i=2;
    }
}
function createLoader(i,data,num) {
    thisLoader=eval("container_mc.loader"+i+"_mc");
    thisLoader._alpha=0;
    thisLoader.loadMovie(data[num].path);
    watcher_mc.onEnterFrame=function () {
        var picLoaded = thisLoader.getBytesLoaded();
        var picBytes = thisLoader.getBytesTotal();
        if (isNaN(picBytes) || picBytes < 4) {
            return;
        }
        if (picLoaded / picBytes >= 1) {
            swapPlace("container_mc.loader2_mc",1);
            alphaTween = new mx.transitions.Tween(thisLoader, "_alpha", mx.transitions.easing.Regular.easeOut,0,100,_global.fadetime,true);
            timerInterval = setInterval(imageGen,_global.numPause,data);
            delete this.onEnterFrame;
        }
    }
}
function imageGen(data) {
    // random, or sequential?
    if (_global.order=="random") {
        // choose random # between 0 and total number of images
        while (randomNum == randomNumLast) {
            randomNum = Math.floor(Math.random() * data.length);
            trace(randomNum);
        }
        loadImages(data,randomNum);
        randomNumLast = randomNum;
    } else if (_global.order=="sequential") {
        // start at 0, increment to total number of images, then drop back to zero when done
        if (p==undefined || p==data.length && _global.looping=="yes") { p=0; } else { break; }
        loadImages(data,p);
        p++;
    } else {
        trace ("order attribute in xml isn't correct - must specify either 'random' or 'sequential'");
    }
    clearInterval(timerInterval);
}
stop();







I created another movie clip on the 2nd layer of the first frame.
How should I reconfigure this so that both movie clips play at the same time?

View Replies !    View Related
Action Script For Adding A Scroll To A Text Box
im loading text from an xml file, im just wondering what the script will be to add a scroll to the box when the text goes over the size of the box.
thanks for any help.

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved