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!
ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 09-23-2006, 07:50 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Nested Functions Calling An Outside Function
Hi guys,
I currently have this piece of code:
Code:
var parentObj:Object = this;
this.form.submit.onRelease = function() {
//Problem here
parentObj.processingAnimationIn();
}
function processingAnimationIn():Void{
//DO STUFF
}
I am unable to call processingAnimationIn() from within the onRelease function.
Any ideas?
Cheers!
Calling Stage Function From Nested MC
Hello all, this is my first time posting, but not my first visit to the site. I do have a problem.
I'm trying to get a set of dynamically generated MCs that are nested about 4 levels down to use a function defined in the main timeline.
Here's the main timeline code (parts not related are missing):
PHP Code:
var domesticLangVar:String = new String();
domesticLangVar = "USA";
var invokeLanguage:MovieClip = new MovieClip();
invokeLanguage.addEventListener(Event.ENTER_FRAME, languageSelector);
addChild(invokeLanguage);
function languageSelector(event:Event):void {
trace(domesticLangVar);
invokeLanguage.removeEventListener(Event.ENTER_FRAME, languageSelector);
this.topBar_mc.langpicker_mc.flagimgholder_mc.addChild(flagimg);
}
Here is the button's code:
PHP Code:
import flash.events.MouseEvent;
var nationLangVar:String;
var thumbImageVar:String;
var domesticLangVar:String;
var img = new Loader();
img.load(new URLRequest(thumbImageVar));
flag_img.addChild(img)
invisflag_btn.buttonMode = true;
invisflag_btn.mouseChildren = false;
invisflag_btn.addEventListener(MouseEvent.CLICK , flagbuttonClick);
function flagbuttonClick(event:MouseEvent):void {
domesticLangVar = nationLangVar;
(root as MovieClip).invokeLanguage.addEventListener(Event.ENTER_FRAME, languageSelector);
var sndClick:click_snd = new click_snd();
sndClick.play();
(root as MovieClip).topBar_mc.langpicker_mc.langpalette_mc.gotoAndPlay("flagsup");
(root as MovieClip).topBar_mc.langpicker_mc.flagarrow_direction.gotoAndStop(1);
}
invisflag_btn.addEventListener(MouseEvent.MOUSE_OVER , flagbuttonOver);
invisflag_btn.addEventListener(MouseEvent.MOUSE_OUT , flagbuttonOut);
function flagbuttonOver(event:MouseEvent):void {
var sndOver:over_snd = new over_snd();
sndOver.play();
flaghighlight_mc.gotoAndStop(2);
}
function flagbuttonOut(event:MouseEvent):void {
flaghighlight_mc.gotoAndStop(1);
}
The reason I have the initial invokeLanguage event listener is because I have a detect via flashvars for the user's default language. I want the user to be able to change the language, but I don't want to have to have the function code in two places...that would be a mess. My thinking was to change the domesticLangVar and add the invokelanguage event listener again, but alas, the flash flayer is looking for the function in the nested button and can't find it. How do I point flash into the right direction?
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
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 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, 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 Function For Mc From Within Other Function?
Hello, been taring my hair out over this little problem. I'm trying to call below function for a movie clip from within an onRelease function on another movie clip.
The full extent of my problem is that i want movie clips to fade in on the stage when i press a movieClip button. The code below works fine if i call it from an onClipEvent handler on the actuall movie clip, but I'd like to control when It happens from somewhere else.
Code:
function fadein(clip, tAlpha) {
clip._alpha += (tAlpha-clip._alpha)/15;
if(Math.abs(clip._alpha-tAlpha) < 1) clip._alpha = Math.ceil(tAlpha);
}
i've tried attachMovie from teh library, but still if just after that try to call this function the movie clip only snaps in on the stage and won't use the function.
Code:
this.onRelease = function() {
homePage._visible = false;
_root.attachMovie("testePage", "testemonialPage", 3);
testemonialPage.onEnterFrame = function(){
fadein(this, 100)
}
}
but no go with this.... i'm sure it's a simple task for someone more apt at AS. big thanks for any help! cheers, david
Calling A Function From A Function
How can I get a function to call another function? I simply cannot get it to work:
ActionScript Code:
function displayMenu() {clearMenu}
This is a cut down version of my code for clarification purposes - it doesn't work either.
Does it have to be in an "on" handler (onClipEvent or onEnterFrame for example)? 'cause I just want it to run the other function automatically without the user having to do anything or the movie having to go to any particular frame. blah
Calling A Function From Within Function
Is there any way to call a function from within a function?
***************************************************
Here is the Function I am calling from:
SET.onRelease = function() {
in1_txt.text = "C";
in2_txt.text = "F";
in3_txt.text = "G";
OUT1.text = "C";
OUT2.text = "F";
OUT3.text = "G";
varKeyShift = 0;
this._parent.varShow = "SET.onRelease";
Output_Key(); // Here is the Function call
};
****************************************
Here is the function I am calling:
function Output_Key() {
this._parent.var1 = 1;
}
*******************************************
I have an Input Text with Variable Name "var1"
but var1 shows no value when clip is run
Nested Function How It Call
Hi all (VS flash MX)
I think the problem is just with path
how to access funciton within function ?
and also how to access their variables ?
something like this
_root.onLoad = function () {
function parent (){
function child (){
return x = 5;
}
}
}
_root.onEnterFrame = function(){
trace(parent(child()));// display undefined (*&*)
}
the only thing I want is how to access function child
into parent function
I hope someone guide me to the right path
bye
Targeting A Nested Function
I have a script that uses a dynamic nested function, but can't seem to target it:
PHP Code:
// this works:
var theFunction:String = "alpha";
this[theFunction].apply(null);
function alpha():Void {
trace ("alpha() called."); // traces -> alpha() called.
}
// this doesn't work:
function outerFunction():Void {
trace ("outerFunction() called."); // traces -> outerFunction() called.
var theFunction:String = "nestedFunction";
this[theFunction].apply(null);
function nestedFunction():Void {
trace ("nestedFunction() called."); // nothing traces; why?
}
}
outerFunction();
Thanks in advance for the help.
Function Ignored With Nested MovieClips
allright another crazy problem that's already taking me 2 hours. I have a pretty big project, but in a test environment I narrowed it doen to the following.
On de _main timeline, first frame:
Code:
_root.attachMovie("First","first", 1 );
I create 2 movieclips (First and Second) and set the linkage as 'export for actionscript', and 'export in first frame'.
code in First:
Code:
this.attachMovie("Second", "second", 1);
second.attachMenuItem("thumbs/mountwossname.jpg");
code in Second:
Code:
this.attachMenuItem = function(img){
trace("img "+img);
}
clearly, what I would suspect is that "img thumbs/etc" is printed in the output. Nothing happens. Now the really weird part is that when I add the function from Second to First, so the code of first becomes:
Code:
this.attachMovie("Second", "second", 2);
this.second.attachMenuItem1 = function(img){
trace("img "+img);
}
second.attachMenuItem1("thumbs/mountwossname.jpg");
this does work. Can anyone help me out coz this is driving me crazy. Thanks!
Nested Function Not Working
Hi, i'm trying to get my gallery scroller to activate on scrollwheel instead of just button click - to do this i've added the listener code and nested the scrolling function inside, however the nested function is not being called at all, is it due to incorrect syntax or something?
Individually the components work fine, i can get traces back on the mousewheel and the scroller does work on button click...Think i am joining the two together incorrectly.
Code:
var yPositions = new Array(0, -150, -300, -450, -600);
var mouseListener = new Object();
mouseListener.onMouseWheel = function(delta) {
// this is an array for storing the positions of the slider
function jumpTo(number) {
// this function takes the variable "number" that is passed from the buttons and takes the corresponding
// value from the array of positions, then sets the new position in the slider to the new position.
slider.newY = yPositions[number];
trace(slider.newY);
trace("test");
}
};
Mouse.addListener(mouseListener);
stop();
Thanks for any help!
[FMX] Nested Function Problem
I have the following function to resize a mc first in height and after that in width.
ActionScript Code:
function resizeX (clip2, wijd, snelheid){ clip2.onEnterFrame = function(){ eindWijd = wijd - this._width; this._width += eindWijd/snelheid; if (this._width > eindWijd - 1 && this._width < eindWijd + 1) { delete this.onEnterFrame; } }}function resizeY (clip, hoog, snelheid){ clip.onEnterFrame = function(){ eindHoog = hoog - this._height; this._height += eindHoog/snelheid; if (this._height > eindHoog - 1 && this._height < eindHoog + 1){ delete this.onEnterFrame; resizeX (mask, 0, 3); } }}resizeY (mask, 0, 3);
After the complete function is terminated ther is still one pixel of the mask visible. How can I solve this?
[FMX] Nested Function Problem
I have the following function to resize a mc first in height and after that in width.
ActionScript Code:
function resizeX (clip2, wijd, snelheid){ clip2.onEnterFrame = function(){ eindWijd = wijd - this._width; this._width += eindWijd/snelheid; if (this._width > eindWijd - 1 && this._width < eindWijd + 1) { delete this.onEnterFrame; } }}function resizeY (clip, hoog, snelheid){ clip.onEnterFrame = function(){ eindHoog = hoog - this._height; this._height += eindHoog/snelheid; if (this._height > eindHoog - 1 && this._height < eindHoog + 1){ delete this.onEnterFrame; resizeX (mask, 0, 3); } }}resizeY (mask, 0, 3);
After the complete function is terminated ther is still one pixel of the mask visible. How can I solve this?
Mc Reference, Nested Function
Hi,
I have a function like this:
ActionScript Code:
_global.printName = function() {
trace (this);
}
If I use this code within a function like this:
ActionScript Code:
mymc.onRollOver = function() {
printName();
}
I get a result as [type Object]. And using trace(this._name).
How can I get the name 'mymc' from the function?
thankyou very much
s.
Nested Function Scope
I have a function in the timeline which I can call from a button (on the same timeline) and my function executes...
Yet when I place the button in a Mc and refrence it with _parent or even _root.path/ I can't get the function to execute.
here's the function incase it changes anything;
function mover(clip, xDist){
clip.onEnterFrame = function(){
clip._x += (xDist-clip._x)/3;
}
}
Anyone help a newbie to functions?
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
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
Calling A Function
Hi Guys,
I have a button inside a movie clip that i want to use to call a function on the main timeline.
Can any one help me out.
This is the function in the main timeline
//calling with button on timeline//
exit_btn.onRelease = function() {
exitPanel();
}
//the function//
function exitPanel() {
easeType = mx.transitions.easing.Strong.easeOut;
var begin = 3;
var end = -306;
var time = 0.5;
var mc = media_mc;
panelSlide = new mx.transitions.Tween(mc, "_x", easeType, begin, end, time, true);
I can call it with a button in the main timeline, but it wont work with a button inside a movieclip. Really stuck.
Calling A Function
Hi guys
suppose you want to call a function let's say:
function ctrl_status () {
}
Now normally to 'call' this function you use:
ctrl_status();
Is there a way to 'build' this 'call' so that I have something like:
"ctrl_"+variable+"()";
Thanx in advance for your help
Calling Function
AS2.0
I currently have a text box, "Coordinates", and a function which loads into it the xmouse and ymouse properties [See Below]. I would like for this function to be called as false/void when I rollOver a separate mc so that I can then load different text, i.e. "click to copy". Then when I rollOut I can call the function true and the xmouse and ymouse will be loaded back into Coordinates.text. The problem is this can't just be done by loading different text into the text box as it opperates onMouseMove so as soon as I move the cursor it would revert back.
//on mc ("Cursor") in which Coordinates.text is located
onClipEvent (load) {
onMouseMove = function () {
Coordinates.text = "X" + _root._xmouse + ",Y" + _root._ymouse;
};
//on mc which I want to have change the contents of Coordinates.text
on (rollOver){
_root.Cursor.Coordinates.text = "click to copy to clipboard";
}
Calling A Function
I have a very basic question. I have a custom class called caurina. I've imported the class and it works great. What i did is use that as a function called slide().
What I would like to do is make that function play when a button is pressed. I can't seem to find out how to do this anywhere. I am using as3 in CS4.
Summary: When btn is pressed go play function slide()
Thanks!
Calling A Function On A MC?
I have a movie clip whose name is 'targetMC'
I have written a function on the MC using the onClipEvent handler.
onClipEvent(load){
function targetFunction(){
do somthing I need...
}
}
I than duplicate the mc several times.
for (i=2; i<=_root.maxDups; i++){
duplicateMovieClip('targetMC','targetMC'+i, i);
}
I need to call the function for each of these MCs at different times, and from different places within the movie.
if I do the following:
_root.targetMC12.targetFunction();
Flash looks for the function on the main timeline within the MC, which is what it should do, but how do I access / call the function that resides on top of the MC?
Thanks,
Hiram
Calling Function
hi I am a bit new at this whole function thing.
I know how to assign functions to listeners, but when I was given advice that I should...
have a single function that the listener calls, and on the first frame of the movie you call that function.
Does anyone know a good tute which would guide me through the calling function thing?
Thanks
Help With Calling Function
I am trying to set a moving function that I can change the speed in each level of my game and can be called for each object that I create. currently I have this function in each symbol, but I need to create it as a global function to be called by each MC instance when created:
this.moving = function() {
if(this.hitTest(_parent.c_belt)){
this._x+=_root.speed;}
if(this.hitTest(_parent.trash)){
trashCount++;
if(trashCount == 1){
_root.score = _root.score - 50;
}
this._visible=false;
}
}
Help?
Calling AS Function From JS
Hey People,
I'm looking at the AS 8 Bible, specifically on calling AS functions from JS and I have done just what they have said... I have a function in my main .as file called "collapseMenu" and I have entered this code in, just under that function
Code:
ExternalInterface.addCallback("runCollapseMenu", null, collapseMenu);
Now in my HTML page, I have this
HTML Code:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>menubar</title>
<SCRIPT LANGUAGE=JavaScript>
function initialize() {
if (navigator.appName.indexOf("Microsoft") != -1) {
flash = window.menubar;
}
else {
flash = window.document.menubar;
}
}
</SCRIPT>
</head>
<body onLoad="initialize();" bgcolor="#ffffff">
<SCRIPT LANGUAGE=JavaScript>
function collapse() {
flash.collapseFlash();
alert('gibds');
}
</script>
<div id="swf">
<object onblur=runCollapseMenu() classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="800" height="280" id="menubar" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="menubar.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="bgcolor" value="#ffffff" />
<embed src="menubar.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="800" height="280" name="menubar" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</div>
</body>
</html>
For some reason, when I click outside of the .swf area though, nothing happens. In the JavaScript console, it says that "runCollapseMenu" is not a function. If I take that like of code out of my HTML, leaving only the javascript alert, it will come up when I click outside of the swf area.
Anyone have any idea why the runCollapseMenu won't register properly for me?
Thanks,
--D
|