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




Calling Function From Another Movie



i use one function in main movie on 1. frame :
Code:
function saveVisitor (my_link){// some action}
This function works in main movie***i load in main movie exter. movie, than need i call this function
Code:
saveVisitor (my_link)
Is it possible?---I tried it but no works maybe path problem only Or must i use _global propety?



KirupaForum > Flash > Flash 8 (and earlier) > Flash MX
Posted on: 05-05-2005, 05:40 AM


View Complete Forum Thread with Replies

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

Calling A Movie Function
how do you call a function from a movie that is two layers back with out using _root???

thanx
shaun

Calling A Function In Another Movie
Is it possible to call one movie's function from another movie?

If so, how would this be done?

Calling Function From Another Movie
i use one function in main movie on 1. frame :

Code:
function saveVisitor (my_link)

{
// some action
}
This function works in main movie
***

i load in main movie exter. movie, than need i call this function

Code:
saveVisitor (my_link)
Is it possible?

---

I tried it but no works mayby path problem only

Calling A Function From Within A Movie
Howdy!

I need to be able to call a centrally defined function within a movie clip that is playing within a movie clip.

Here is what I have tried: In the main timeline i have a whole level to itself that only contains
ActionScript Code:
function functioname(){
    script;
}
. And then a MC is loaded that has another MC in it. It is within this second MC that I want to call the previously defined script. Here is how I am trying it
ActionScript Code:
onclipevent(load){
    functioname();
}
, and it does not seem to work.

Do i need to be using a _parent or _root tag? Or am i totally going about this the wrong way.

Cheers

Calling Function From Another Movie
i use one function in main movie on 1. frame :

Code:
function saveVisitor (my_link)

{
// some action
}
This function works in main movie
***

i load in main movie exter. movie, than need i call this function

Code:
saveVisitor (my_link)
Is it possible?

---

I tried it but no works maybe path problem only

Or must i use _global propety?

Calling A Function Within A Movie Clip
On my main timeline, I have a movie clip located on frame 3. Inside that
movie clip I have a function. My goal is to call that function from frame 4
of my main timeline.

I have tried the following code with absolutely no results:
_root.myMovieClipName.myFunctionName();

Any suggestions?

Help Calling Function From Movie Clip
Basically myset up is this, in the main timeline on the first frame I load the function fadeBGAudio and the mp3, now when I reach a certian frame on the main timeline, my menu which is in a movie clip loads (menu_mc). In the menu are several buttons any one of which I need the fade sound call to operate from.

This is my fade sound code. How can call the fucntion from with in my menu_mc?

Code:
// variables for sound object
var bgVol = 100;
var bgVolMin = 0;
var bgVolMax = 100;
var bgVolInc = 5;
///////////////////////////////////////////////////
// this function fade the background music down or up
function fadeBGAudio(upDown, sndObj) {
this.onEnterFrame = function() {
if (upDown == 1) {
// Fade the audio up
bgVol += bgVolInc;
if (bgVol<=bgVolMax) {
sndObj.setVolume(bgVol);
} else {
sndObj.setVolume(bgVolMax);
delete this.onEnterFrame;
}
} else {
// fade the audio down
bgVol -= bgVolInc;
if (bgVol>=bgVolMin) {
bgsound.setVolume(bgVol);
} else {
bgsound.setVolume(bgVolMin);
delete this.onEnterFrame;
}
}
};
}

/*
// call function to fade IN the BG audio
fadeBGAudio(1, bgsound);
// call function to fade OUT the BG audio
fadeBGAudio(0, bgsound);
*/


On my menu button in the menu_mc I have this:

Code:
on (release) {
//////////////////////
for (var i in _root) {
if (typeof (_root[i]) == "movieclip") {
removeMovieClip(_root[i]);
}
}
///////////////////////////////
//stopAllSounds();
_root.fadeBGAudio(0, _root.bgsound);
_root.gotoAndPlay(1);
}

Problem Calling A Function In A Sub Movie
If I have the movie clips
---------------------
_root.Movie
_root.Movie.subMovie
---------------------

If I am in _root.Movie and I want to call a function myfunction(x) in _root.Movie.subMovie for some reason this does not work.

---------------------
from _root.Movie
---------------------

_root.Movie.subMovie.myfunction(x);

Can you call a function in a movie below the current movie you are working in?

Calling Function On Movie Instance?
Say I have a movie clip called viewer.

Inside "viewer" I have a function defined in frame 1:

function foo(){
trace("foo called");
}

Then I do this:

this.attachMovie("Viewer", "window", 0);
window._x = 100;
window._y = 100;
window.foo(); //this doesn't work

Why window.foo() doesn't work?
The "viewer" movie is shown, but the foo
function is not called.

I think I am missing some basic concepts of flash...

Thanks.

Calling Function In Movie Clip
Hi, I'm tired now of searching about it, I'm gonna ask it this way :


First: Can we do?
Second: if yes, how?


What I'm trying to do is creating function into a movieClip.
Like :
function foo(message:String)
{
trace(message);
}

And call it externally like :
_root.myMC.foo("Hello World");

PS : ho, and I put this function at layer1 first frame of the movie clip, where should I put it?


Because after this I'm gonna have to duplicate this MovieClip and call functions to do action on it... Like populating the menu, etc.

Any idea? Thanks

Function GetURL Not Calling Right In Movie
I'm trying to get multiple buttons to work inside of a movie clip. I've created the functions on the main timeline. It's only wokring the first time through on the first button though.

Here's a link to the site; http://www.aspenspasstl.com ;the problem banner is on the lower left.

Here's a link to the fla file. http://www.apepinc.com/aspenspas/home_spa_info.fla

Code that shouldn't be giving me a problem:

mc_spas.canyon_button.onRelease = function() {
getURL("

Calling A Function Embedded In A Movie
I am trying to call a function i have created inside a movie. I can load the movie to a container with not issue, re -position the movie as well.

However when i call the function from the root, i get no response ... here is the as code below.


ActionScript Code:
//root function_root.attachMovie("worldMap", "geoMap", 75);    geoMap._x = 663;    geoMap._y = 158;    geoMap.createRond(250, 90, 150);//function inside geoMap moviefunction createRond(rondSize, x_position, y_position){    x = "rond"+x_position;    trace(x);    trace(rondSize);        this.createEmptyMovieClip(x, 90);    eval(x).lineStyle(rondSize,0,100);    eval(x).lineTo(.55,.45);        var newColor = new Color(x);    newColor.setRGB(0x00CCFF);        eval(x)._y = y_position;    eval(x)._x = x_position;}

Calling Function From External Movie.
Last edited by DavidNetk : 2003-09-22 at 19:08.
























Never mind it has been done.

Calling A Function In Loaded Movie Clip
I have a movie with two frames. The first frame has the following code.

_root.createEmptyMovieClip("Nat1Holder",1);
loadMovie("Nat1.swf","Nat1Holder");

This frame loads the movie successfully.

In the next frame, I would like to call a function that is in the loaded movie "Nat1Holder".

My code in the second frame is .......

_root.Nat1Holder.populatefield();

This doesn't work though! Is it possible to call a function in a loaded movie?

Thanks

Calling A Function In The Main Movie From A Loaded Swf
I realize this is probably a very basic question, but I have loaded a SWF file into another movie. I now want to call a function in the main SWF. Is there a way to do that? Alternatively, I have a custom class where I could put the function, but I haven't been able to figure out how to call it from the loaded SWF either. Do I somehow need to associate the class with the main movie, or...?

Calling A Function Inside A Flash Movie Via JS
I need to call a function inside a Flash Movie via JS (to update a textfield and sum Vars) can someone point me in the right direction???

I tried to figure out the external interface api, but i dont understand how it really works ...

For example:

JS calls function "Fieldupdate" and in the Flash Movie the Fields and Vars Updates

thanx in advance

ChromeD

Calling A Function On Root From A Loaded Movie
Ok,
when calling a function on root from movieClip inside a swf Ive loaded onto a layer above what path can I use? I dont want to use _parent._parent._parent.function cos thats just stupid.

Ive tried _root.function
Ive tried _level.0

Neither of these seem to work for me. What am I doing wrong?

SetInterval Calling Function Even When Movie Unloaded?
We have a custom built Flash education template created inhouse. One section allows you to click a link for a resoruce which loads a swf that loads an mp3 or flv, image, loads txt, etc.

I have a function to start the flv or mp3 player and the function is called with a setInterval so I can delay the start. Every once in a while I have seen a bug that the function will keep being called (see it with a trace statement) over and over, and yes I am clearning the setInteval in the function, but the odd part is this will keep happening and even trace out even when the movie has been unloaded!!!

I have no clue what is going on...any ideas? It's a hard bug to reproduce so I am just lost!

Calling A Function In A Duplicated Movie Clip
I have a movie clip, navLink_mc, on my timeline. In that movie clip is this function:

Code:


function test(){
trace("it worked");
}



From my original timeline if I run navLink_mc.test(); then the function runs. However, if I create a duplicate of the movie with

Code:


duplicateMovieClip(this.navLink_mc,"myCopy",this.getNextHighestDepth());


then running myCopy.test(); doesn't do anything.

Calling Function From Button Within Duplicate Movie Clip
Could someone help me as I was bangin my head against this brick wall all yesterday!

This code works at the moment, but I have a button within the duplicate movieclip thisItem that I want to call the function (openLink) for the thisItem in question.

myXML = new XML();
myXML.ignoreWhite = true;
//myXML.load("menu.php");
myXML.load("menu.xml");

function handleLoad(status) {
status ? makeMenu() : trace("Error parsing XML.");
}
myXML.onLoad = handleLoad;

function makeMenu(){
myItem = "clip";
myTrack = "tracks"; myX = 0;myY = 0;


for ( i=0; i<myXML.firstChild.childNodes.length; i++) {
title = (myXML.firstChild.childNodes[i].attributes.id);
linkmp3 = (myXML.firstChild.childNodes[i].attributes.linkmp3);
this.attachMovie(myItem, title, i+10000000000);thisItem = this[title];
thisItem.title = (title);
thisItem.linkmp3=(linkmp3);
thisItem._X = myX; thisItem._Y = myY+=(thisItem._height);
_level0.holder.count = i+1;
_level0.holder.clipheight = (thisItem._height);

#thisItem.onRelease=function(){
openLink(this.linkmp3); # //this I want on the button download!!
}
}
}

function openLink(linkmp3){
if (linkmp3!=null){
getURL(linkmp3,"_blank"); }else {
trace ("Link does not contain a URL");}
}

Here's the files

tracks.zip

Any help much appreciated.

Calling A Parents Timeline Function From Nested Movie Clip
ok ... i am going to ask what i think is a rather dumb question on my behalf. I've come straight from using actionscript 1 to actionscript 3. I tried searching so I apologise if this question has been answered before. But nothing I found seemed like what I was trying to do. I am use to using OOP with other languages so the transition has been somewhat ok but the thing i dont understand is why i can't do something like this:

1. I create a movie clip (clip_nested) nested within another movie clip (clip_top).
2. I create a function on the main timeline of clip_top called tryMe()
3. I try to call this function from within the nested clip and it gives me an error in the compiler that "1120: Access of undefined property clip_top.

way i called it is:


Code:
this.parent.tryMe();
Why won't this work? Also, if i wanted to call this object from the top level clip..how would i do this?

..i tried something like this:


Code:
this.clip_nested.addEventListener(event:MOUSE_OVER, functionToDealWithThat);
why will this also fail? I am not using classes for this at this point.

cheers for any help!!
stace

Function And Target Problem (calling From Inside A Movie Clip's Timeline)
(Using Flash MX 2004 Pro, AS2)
I have a whole bunch of custom setInterval functions defined in an included AS file that have either a 'gotoAndPlay' or 'function()' action within. All of my setInterval functions that are being called globally from the main timeline of the movie work beautifully, however I have two calls that are calling their function from within a movie clip of the same timeline...they are not working, they're not even calling back to the function. Here's my function code in the AS file:


Code:
function cardRevealPause(){
gameLogic.gotoAndPlay("shuffle");
clearInterval(welcomeTimeOutIntervalID);
clearInterval(gameTimeOutIntervalID);
clearInterval(cardRevealPauseIntervalID);
}
Here's my global call code from within the movie clip 'gameLogic' timeline:

Code:
_global.cardRevealPauseIntervalID = (cardRevealPause, _global.cardRevealPauseInterval);
ANy thoughts as to why this won't work for me??? Thanks in advance!

Function And Target Problem (calling From Inside A Movie Clip's Timeline)
(Using Flash MX 2004 Pro, AS2)
I have a whole bunch of custom setInterval functions defined in an included AS file that have either a 'gotoAndPlay' or 'function()' action within. All of my setInterval functions that are being called globally from the main timeline of the movie work beautifully, however I have two calls that are calling their function from within a movie clip of the same timeline...they are not working, they're not even calling back to the function. Here's my function code in the AS file:




Code:
function cardRevealPause(){
gameLogic.gotoAndPlay("shuffle");
clearInterval(welcomeTimeOutIntervalID);
clearInterval(gameTimeOutIntervalID);
clearInterval(cardRevealPauseIntervalID);
}
Here's my global call code from within the movie clip 'gameLogic' timeline:


Code:
_global.cardRevealPauseIntervalID = (cardRevealPause, _global.cardRevealPauseInterval);

ANy thoughts as to why this won't work for me??? Thanks in advance!

Function For Calling Content From Button In Child Swf To Holder In Parent Movie
Hello i need to load content into a parent movie but the button is in the child swf. The button on the child swf is
a_btn.onRelease = function () {

what do i add to make this call the content on the _root of the movie ?

Calling A Function, External To The Calling Class
hello to everyone, who looks at this post
So there's a class, that needs to call/access an external function.
'External' (imho) in this case would be any function, declared outside of the class.
How is it possible to:
1) call a function declared in the main timeline.
2) call a function in another class (i suppose, the only way of doing it is by importing the class having this function into the calling class?)

Calling Constructor In Condition: A Function Call On A Non-function Was Attempted.
Hi guys,

Please help me somebody with this cos I have really no idea. I have made a simply condition calling a constructor of a class. Today I had to add an "else if", what caused the compilator to show me "A function call on a non-function was attempted."...

ActionScript Code:
function loadIt() {    if (var1 == "1") {        var a:SomeClass = new SomeClass(true);    } else if(var2 == "1"){         var a:SomeClass = new SomeClass(false); //<- if this is not here, everything works fine    } else {        var b:SomeOtherClass = new SomeOtherClass();        b.init();    }}

Any ideas? Thanks for any help!

Poco

Function Calling From The _root But Call A Function Within A Instance
I have created a new instance 'Check_1' to work as a checkbox with a set of propertys and functions.

All ive done is created the functions in a script in the first frame of the instance-movie these are...

Simple......
================================================== =======

selected = -1;
function select_frame (FrameNum) {
gotoAndPlay (FrameNum);
}
function change_select () {
select_frame(2);
trace (selected);
}
function change_unselect () {
select_frame(1);
selected = -1;
}

================================================== =======

now from the _root i wish to call the above functions to change the instance propertys, it all works fine from within the instance but i also need to use the functions for that instance from the _root...

iv'e tried the follow with no joy...


_level0.Check_1.change_select()


Any light would be greatly appreciated.

OOP In Flash: Calling A Function W/in A Function Class?
Okay so I am reading through sens tutorial on OOP and updating my game that I am making. It is much easier to code this way (IMO) but still hitting snags.
I am trying to get through this code:

ActionScript Code:
House = function(){        this.floors = 4;         this.siding = "Red";         this.outputSiding = function(){            trace(this.siding);         };     };         // create an instance of the House class     myHouse = new House();     myHouse.outputSiding(); // traces "Red"  

Now as it seems to me, I have nearly the same thing (I will condense this to save space):

ActionScript Code:
//set new character function()character = function (depth, x, y, charType, name, HP, MP) {    //sets stats used; this works fine :)        //attachMovie and set x/y     _root.attachMovie(this.name+"_mc", this.name+"MC", this.depth, {_x:this.x,_y:this.y});    /*this is where I am having trouble; it won't do anything!I have tried tracing to no availalso, can I set the x and y coords somehow with thealready made object x and y? I am tired right now andcan't think of a way but what I have done, which doesnothing as this function won't go!*/    statsBox = function(depth)  {        this.depth = depth;        trace(this.depth+newline+'hello');        this.x = enemy._x+130;        this.y = enemy._y-50;        _root.attachMovie("stats_mc", statsNameMC, this.depth, {_x:this.x,_y:this.y});    };};enemy = new character(30, 350, 200, 'enemy', 'genericName', _root.EHP, _root.EMP);enemy.statsBox(50);

that's it, pretty much. So what's wrong? Maybe I'm too tired for this right now...
thanks.

OOP In Flash: Calling A Function W/in A Function Class?
Okay so I am reading through sens tutorial on OOP and updating my game that I am making. It is much easier to code this way (IMO) but still hitting snags.
I am trying to get through this code:

ActionScript Code:
House = function(){        this.floors = 4;         this.siding = "Red";         this.outputSiding = function(){            trace(this.siding);         };     };         // create an instance of the House class     myHouse = new House();     myHouse.outputSiding(); // traces "Red"  

Now as it seems to me, I have nearly the same thing (I will condense this to save space):

ActionScript Code:
//set new character function()character = function (depth, x, y, charType, name, HP, MP) {    //sets stats used; this works fine :)        //attachMovie and set x/y     _root.attachMovie(this.name+"_mc", this.name+"MC", this.depth, {_x:this.x,_y:this.y});    /*this is where I am having trouble; it won't do anything!I have tried tracing to no availalso, can I set the x and y coords somehow with thealready made object x and y? I am tired right now andcan't think of a way but what I have done, which doesnothing as this function won't go!*/    statsBox = function(depth)  {        this.depth = depth;        trace(this.depth+newline+'hello');        this.x = enemy._x+130;        this.y = enemy._y-50;        _root.attachMovie("stats_mc", statsNameMC, this.depth, {_x:this.x,_y:this.y});    };};enemy = new character(30, 350, 200, 'enemy', 'genericName', _root.EHP, _root.EMP);enemy.statsBox(50);

that's it, pretty much. So what's wrong? Maybe I'm too tired for this right now...
thanks.

[F8] Calling A Function Froma Function
Please excuse my ignorance, but can i call a function from a different function. I'm not sure how to do it.

eg:
myBut.onPress = function ()
{
_root.currentimage=1;
_root.crumb.titles="/fashion&lifestyle";
_root.loadLeft._visible=0;
FashStrip.mc01._alpha = 60;
}

how do i integrate this into the above function?:
function fadeOut()
{
extendTween = new TweenExtended(_root.loadLeft.fashThumb,["_alpha"],
easingType4,[_root.loadLeft.fashThumb._alpha],[0],1,true);
}

i know i could put it straight in the button function but i want to reuse the fadeOut function again many times!!! (just learning to keep my code nice and neat)

Rat

Calling Function From Within A Nested Function
Hi guys,

I current have this piece of code:


Code:

var parentObj:Object = this;

this.form.submit.onRelease = function() {
parentObj.processingIn();
}

function processingAnimationIn():Void{
//DO STUFF
}
But I can't get this to work. Does anyone know what's going on?

Thanks!

Calling A Function Inside Another Function
Hi All,

I've set up two functions (friendsClick and policyLink) I would like to use everything inside of friendsClick inside of policyLink but I'm not sure how to go about doing it. I get the following error:
1136: Incorrect number of arguments. Expected 1.

My code looks similar to:


Code:
function policyLink(e:MouseEvent){
friendsClick();
"all my other info here"
}
I can just copy everything from the friendsClick function and paste, but I'm trying to limit my amount of repetitive code (I'm trying to get better at that). Please Help.

Calling A Function Inside Another Function
Hi i've created some functions that run when diffrenent buttons are pressed, and they work fine, but i want something else to do the same thing when any of the buttons are pressed, i thought the easiest way to do it was to create a function and call it each time one of the buttons are pressed. but what is the code to run the function??

all the code is on the main timeline..

i've wrote this and it doesn't work....

the function i want to run is:


brentGandS = function (){
_root.menu_mc.brent_mc.tween("_width",200,5,"easeoutelastic")
}


and the on press function is:

menu_mc.contact_btn.onPress = function() {
window_mc.resizeTo(250, 350, speed, "easeoutelastic", onEnda);
brentGandS
};

any ideas????????

Calling A Function
I set a function in frame one of the main stage called salWalk.

I access it in the last frame of _root.sal but it is not calling the function.

What I wrote is this in the last frame:

stop ();
i = Math.round (Math.random () * 40);
if (i =26){
i = 41
}
salWalk(i);

and the function is this:

function salWalk(i){
sal_[i].gotoAndPlay("move");
}


what am I doing wrong?

Calling A Function
I have placed a function on a timeline which reads:

function intro () {gotoAndPlay ("Scene 2", "one");
}

I am now trying to call that function from a button placed on a movie clip, the script I have placed is:

on (release) {
function intro() {
}
}


however I am not sure what the command is for calling the function because this seems to relate to creating another function, I would be grateful to anyone who can help.

Calling A Function
I'm having difficulties with a .swf that is loaded into _level1 that is calling a function on _level0. It works when loaded localy:
ex: loadMovieNum("menu.swf", 1);

It does not work when loaded from a URL
ex: loadMovieNum("http://www.xyz.com/www/menu.swf", 1);

The calling code of the function is located in the movie being loaded into _level1.

ex:_level0._root.myFunctionName();

Function Calling
Can anyone tell me how to call functions from different levels in my movie.

I have several functions ... some on the main timeline, others in movie clips ... and i need to call these from anywhere withing my movie, for example when i call a function from within a movie it does not work.

Function Calling . . .
Friends,

I have what appears to be a simple function. However, weverytime it runs my variables come back as undefined. Here, take a look:

FRAME 1:

function slideAmount (functionBoxDepth) {
var functionSlideAmount = functionBoxDepth/480;
return functionSlideAmount;
}


MOVIECLIP in FRAME 1:

onClipEvent(load){
boxDepth = getProperty(this,_height);
trace(boxDepth);
//So far, so good.
thisSlideAmount = slideAmount(boxDepth);
trace(thisSlideAmount);
// DAMN!
}

The second trace command always returns "undefined."

Me so confused!

Calling A Function?
ok maybe this beolongs in newbies but I can't figure this out. I have a dynamic calendar in a movie clip wihtin the main timeline. The main timeline, onRelease of a a button for location, draws the data in using an asp file and tellTarget's the calendarwindow instance of the calendar symbol. There is a function in frame one of the calendar symbol to parse the data a build the calendar (via dynamic text blocks).

how do I get that function to trigger automatically when the calendarwindow begins playing?

i can get it to work when I have a button in frame one which calls the function and then gotoAndPlay's the frame with the built calendar but not autorun. any help would be much appreciated. code to follow:

on (release) {
loadVariables("flavorsflash.asp?loc=2&m=10", "calendarwindow");
gotoAndPlay(5);
tellTarget ("calendarwindow") {
gotoAndPlay("yorc");
}
}

and right now I'm using this to all the function, it's like the fourth thing I've tried:

offsetDays.call(null, firstWeekDay);

thanks

lateralis

Calling Function
Hi,

I'm loading XML into flash.
but insted of using the standard;

Code:
thisXML = new XML();
thisXML.ignoreWhite = true;
thisXML.onLoad = myLoad;
thisXML.load("environment_page.xml");

I've made an XML preloader, but now i can't call the function.
i'm trying;

Code:
myLoad(thisXML);

but of course that won't work. i'm not too good with functions...

anyone??

many thanks

Calling A Function In A MC
I am trying to call a function that is in a MovieClip. I have a movie clip named "box" and a function in that mc called myFunction.
//----- in the box MC on the _root-------
function myFunction()
{
trace("this is a function")
}
//----- on the _root timeLine
box.myFunction()

What do i need to do difrently

Calling A Function Using If
Hi

I got this code from someone on FK recently. And it works a treat.

on (release) {
_root.remoteMovie.tempMovie._visible = true
obj = new Object();
obj.interval = function() {
_root.remoteMovie.tempMovie._visible = false
};
setInterval(obj, "interval", 2000);
}

The trouble is that I want to have three seperate buttons calling the same function. So I tried putting it in the main timeline and using variables on the buttons to call it.. but it don't work.. can anyone tell me why?

//button code

on (release) {
_root.tempOn = true;
}

//maintimeline code

if (_root.tempOn == true) {
_root.remoteMovie.tempMovie._visible = true
obj = new Object();
obj.interval = function() {
_root.remoteMovie.tempMovie._visible = false
};
setInterval(obj, "interval", 2000);
}

Am I right in thinking it is because "if" only checks the variables one time?? If so what do I change it to??

Calling A Function
_global.loadImage = function(Image) {
trace("LoadImage");
preload(ImageSpace);
}

function preload(preloadContent) {
trace("preloader");
}


"LoadImage" is returned when loadImage is called, but "preloader" is not. Any idea why this is?

Thanks

Calling A Function
Hey, what is wrong with this?
Code:
initvalues = function (X, Y, XYscale, Alpha) {
this._x = X
this._y = Y
this._xscale = this._yscale = XYscale
this._alpha = Alpha
}

var mc_a = _root.mc_1
var mc_b = _root.mc_2

trace ("mc_a = " + mc_a) // returns '_level0.floor_1'
trace ("mc_b = " + mc_b) // returns '_level0.floor_2'

mc_a.onLoad = initvalues (10, 10, 20, 40)
mc_b.onLoad = initvalues (100, 100, 60, 100)
I expect _root.mc_1 to attain the properties _x = 10, _y = 10, _xscale = _yscale = 20, _alpha = 40
and _root.mc_2 to have the properties _x = 100, _y = 100, _xscale = _yscale = 60, _alpha = 100. However, _root.mc_1 appears above _root.mc_2, having the same properties.

Any ideas?
Thanks

Calling Function Of A MC From Another MC
Hi,

I need a little help concerning the possibility of calling a function declared in a frame of a MC from another MC in this MC.

I have 2 buttons in MC1. But, I want in my MC1.2 to know wich button was pressed.

Do someone can help me with this ?

Calling A Function - Help
When the close button in the popup is pressed it wont call the function from the main menu.

Can someone tell me why this function aint been called from the main menu?

Popup menu

// calls Var
this.window_mc.jpgwindow_mc.loadMovie(_level0.jpgV ar + ".jpg");

// calls this function from the main movie
window_mc.close_btn.onRelease = function() {
_level0.popUpClose(window_mc);
trace(_level0.jpgVar);
}

main menu

// functions to close pop-up
function popUpClose(window) {
unloadMovieNum(2);
for (var item in buttons) {
eval(buttons[item]).enabled = true;
}
}
//Button Code
button1.onRelease = function() {
_level0.jpgVar = 3;
popUpOpen("landpopUp.swf");
};


Now the trace is a test that pulls up the number from the main menu to test that its reading

from the main menu. This works fine and returns the varable so its finding the number from the

_level0. Its just not calling the popupclose function. Whyyyyyyyy.

This is tearing my hair out!!

Calling The Same Function Again And Again.
I have a function that changes an MC’s alpha from 0 to 100%. I use this same function over and over, once for each MC (there are 10 of them). Is it possible to compact my code, so that I only have to write this function once while calling it 10 times.

At the moment, my code looks like this:

var speed:Number=20;

tile_1_mc._alpha=0;
tile_2_mc._alpha=0;
tile_3_mc._alpha=0;
tile_4_mc._alpha=0;

…and so forth till tile 10.


AlphaIn();

function AlphaIn (Void):Void{
tile_1_mc.onEnterFrame = function() {
this._alpha += speed;
if (this._alpha>=100) {
tile2();
delete this.onEnterFrame;
}
}
}

function tile2(Void):Void{
tile_2_mc.onEnterFrame = function() {
this._alpha += speed;
if (this._alpha>=100) {
tile3();
delete this.onEnterFrame;
}
}
}

function tile3(Void):Void{
tile_32_mc.onEnterFrame = function() {
this._alpha += speed;
if (this._alpha>=100) {
tile4();
delete this.onEnterFrame;
}
}
}

function tile4(Void):Void{
tile_4_mc.onEnterFrame = function() {
this._alpha += speed;
if (this._alpha>=100) {
tile5();
delete this.onEnterFrame;
}
}
}

…and so forth till the last tile10 function is called.

TIA!

Calling A Function
i have this function

function fadeIn(clipName)
{
extendTween = new TweenExtended(clipName,["_alpha"],easingType2,[clipName._alpha],[100],2,true);
}

how do i call it, in terms of i want multiple clips to fade in when i start my movie eg.

clip1._alpha=0;
clip2._alpha=0;
fadeIn(clip1);
fadeIn(clip2);

i'm missing something as it not working at the Mo!!!
Rat

Calling A Function From Another SWF
Hello,

I'm building a flash file called "training_intro" that plays a series of flv's through another flash file called "video_player". With a lot of help from you good people, I've got a listener on "video_player" that tells me when the flv is done. When that happens I need to trigger a function in the main flash file "train_intro". How do I send a call between swf?

Thanks

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