Actionscript 3.0 :: Calling Functions Between Different Class Files.
Mar 14, 2010
I'm new to writing several different class files.. and trying to make a set of boxes that expand/collapse by mouse click and timer.I have 4 class files, Box, BoxGroup, BoxTimer, and Main.I can call the functions in Box class from BoxGroup class, but not the functions in the BoxTimer class. it keeps throwing this error. I don't understand why since i'm using the same method between the other 2 class files..ReferenceError: Error #1069: Property timer_start not found on CollapsingBox and there is no default value.at CollapsingBoxGroup/on_click()
I'm new to writing several different class files.. and trying to make a set of boxes that expand/collapse by mouse click and timer..
I have 4 class files, Box, BoxGroup, BoxTimer, and Main.
I can call the functions in Box class from BoxGroup class, but not the functions in the BoxTimer class. it keeps throwing this error. I don't understand why since i'm using the same method between the other 2 class files...
ReferenceError: Error #1069: Property timer_start not found on CollapsingBox and there is no default value. at CollapsingBoxGroup/on_click()
When test on cs4 (contol>enter) I get following error 1061: Call to a possibly undefined method playVideo through a reference with static type flash.display:Sprite
i want to be able to call the function keyDowns() from my main file on ENTER_FRAME. However, i can't seem to get the syntax/definitions right. here's the function within class Hero:
ActionScript Code: public function keyDowns(event:KeyboardEvent){ if (event.keyCode == 65){
[Code]....
then in the main file i create an instance of Hero called turret i want to call turret.keyDowns() every frame. i'm trying to use this, but i get an error message "1120: access of undefined property event."
This seems like it would be really easy but for some reason it's not working.
I have a class file, class DataSet, which right now only takes an XML file, parses it, and pushes the XML into an array:
The object is instantiated and an XML file is passed back to the object definition. If the XML file is successfully loaded, the class should then called the function parseXML() and put the data into the array.
But for some reason, parseXML() is never called. I have no idea why this isn't working, because the syntax checks out and I've seen millions of other files where functions call other functions.
How do I write my class so it passes all of its functions/methods to the calling movieclip? For example, the following code imports my graphics class and creates a square:
ActionScript Code: import sprites.vectorGraphics; var vGX = new vectorGraphics(); var newSquare = vGX.createVector(this, 'square', 'rectangle', 20, 20, 0xff0000, 1, 0x0000ff, true);
Short description of my project:I'm making a "flash-car-damage-registration-program" where a user can click on a part of a car, make two choices (from two comboboxes) that describes the damage, and then save it in a datagrid withing flash.I have split up the code in different class files:I have a damage.as class file that describes the damage and its properties.I have a carPart.as class file that extends the Movieclip class. This sets all the propertiesof each carpart and where the roll-over/out eventlisteners are, pluss som escriptive text to each carpart. This works the way I want it to. This is just to quickly give you an idea of what I'm working on.So to the real question or problem: I have a LoadMyXmlData.as class file where I load some xml data, this works fine. A function in this class takes a combobox and a xmllist as parameters.
I want to populate the mentioned comboboxes from the xml data. Both comboboxes are on the stage within another movieclip, but I can seem to access them. (yes, they have instancenames etc) I get error 1120: 'Access of undefined property'. I have tried ways like: containingMc.comboboxMc' and so forth but no luck. I have been searching the web for days for a solution to my problem, but nothing so far.
I have a series of calculations i'm doing over a bunch of objects stored in a array. Each function is pretty CPU demanding but if you only run one function, it just works fine.
If I have a function and I want to call a variable from another function (only 1variable), how do I do it? I know in the olden days you could set the variable to local or global, but that does not seem to work anymore. There is only 1 variable I need access to, but all the tutorials I have come across talk about making classes for multiple variables.
I can't get it but, i'm coding in as3 and i can't target a function from a swf file loaded in the DisplayObject loader in any way. I don't want to create a class to make this function works. It's a simple function, made to change a picture every time the user navigates on another swf. Well. The point is, why in the name of God, the as3 cannot target another swf? How can i do it?
I have made an event listener:text0_mc.addEventListener(MouseEvent.CLICK, showMe);showMe is a function, but I need it to call more than 1 function at once i.e. -ext0_mc.addEventListener(MouseEvent.CLICK, showMe1, showMe2, showMe3, showMe4, showMe5, showMe6, showMe7);Each function contains an if statment as below.
function showMe1(event:MouseEvent):void { if (shuffledArray[1]==orderArray[1]){
Is there any way to call two functions concurrently at the same time in AS3? I have two functions which do very sensitive things, a difference of 0.1 second is considered failure.
I'm loading a flash file using the built in Loader class. How can I call one of the original swf's functions from the loaded swf?I know about LocalConnection and using that with other SWFs on the same webpage, but is there a better way of doing it if you're loading an swf within another? The reason is that I need to get a return value from the function, and local connection's send() only provides a true/false.
I have this function that builds menus, and I'm using a tweening class function to move the menu items around. The thing is that when calling the tween function I need the submenu building function to wait until the tween is finished otherwise things start freaking out. It's organized like this (pseudo code):
[Code]...
The problem is that I need the first tweening to finish before I can build the submenu. I've tried using the onMotionFinished, but it doesn't seem to want to call a function nestled into another function (in this case buildMenu()).
while the condition of a if statement is true, as in the following hypothetical example, will it keep executing that code continuously until the condition somehow becomes false?
i.e. - will it keep trying to load the photo into the photo_movieClip instance continuously until the condition is false?
Code:
if (condition == true) {photo_movieClip.loadPhoto(image); //send image from array to load into photo_mc};
[i]...If so, how can i make it call that function only once even if the condition remains true?
I have this REALLY wierd problem. I have a MovieClip that is attached onto the stage. In this MovieClip I have the init() function. When I try and call this function, after the MovieClip has been attached on stage it doesn't work! I can't belive it!
its a site about interior design. my job is to add some code to do something. i checked the code and his approach is not so good.. he's coding inside objects and frames at the same time. (ive read many actionscript books and this is a really bad practice). Here's the problem... he wants this to be implemented in the site...1.) in the gallery there is a scrolling thumbnails, he wants this to pause about 4 seconds then it will start to scroll..(ive already fixed this by creating a function interval.
Here is where my problem is...2.) When you click the thumbnail, the enlarged view will pop up.. the enalarged view are external swfs... the client wants that when you click on the thumbnail, the scrolling will stop and the external popup enlarged image will come out...this external swf has an exit button to go back to the main gallery window which is another swf... so the client wants that when you hit exit from the external swf popup window, the scrolling will resume.... im having a hard time figuring this out because i dont know how to call a function from an external swf to the main movie (the gallery page) Ill post the fla of main movie, gallery and a single external swf link of the thumbnail. just click on the first picture that will appear on the gallery
I was able to find different threads about random loads: the most are photocontainer, well I also found a text random loader But I can't find some about function random calling: in a site I'm building I have three functions (but other will be added) that when called in callback change general graphic appearance, loading a dozen of different parts in various container with attachMovie; I wish a function that loads them randomly
Actually I'm trying: //variable "funArr" with the three function names var funArr:Array = new Array("montaspazio", "montabilancia", "montaaereo");
i'm trying to call a function on a clip, but i want to use a variable that i'm sending to the clip so that when the one function gets done it knows what to do next. i just have no idea of what the syntax would be. here's a sample.
I'm having some trouble calling a JavaScript function from the HTML file I've embedded my SWF in.I'm currently using Flash 8.I'm trying to to simply call a function which will open an alert window, but when I click my button, nothing happens.
I've used the code below to load swfs into my tileList and set their colors using setData() within each swf. Everything seems to work except "source:e.currentTarget.content". The swfs seem to be mixed up randomly each time it runs. Their colors are set correctly and all the other tilelist info is correct. What have I done wrong with "source:e.currentTarget.content"? I can swap "source:e.currentTarget.content" with "source:myXMLList[loadPosition].source" which gives me the correct swf but then the colors aren't set.
for(var f:int = 0; f<myXMLList.length(); f++){ var ldr:Loader = new Loader(); ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e:Event):void{ Object(e.currentTarget.content).setData(myXMLList[loadPosition].param eter[0], myXMLList[loadPosition].parameter[1]); [Code] .....
I don't understand why within my function, initially the status of stage.scaleMode via a trace() is NO_SCALE, then it becomes SHOW_ALL. The code below is found at three different location in my overall code.