ActionScript 2.0 :: Reference All MCs From Outside The First Function Correctly
Jul 31, 2006
Got a list of MCs being populated from an XML file. Basically a list of two different types of information. Some are type A, some are type B.
Want to have a couple buttons that filter based on type (so if I push the button for type A (called "typeAbtn" below), only those MCs appear and type B MCs go to _alpha = 0 or something).
Can't seem to come up with a function to do it. I can't figure out how to reference all my MCs from outside the first function correctly.
terrible attempt:
Code:
function showMCs() {
for (var j = 0; j<stuff.length; j++) {
MC = timeline_mc["MC"+j];
I've got a function which is constantly running to see if a set of movie clips (ball0_mc, ball1_mc etc.) have been placed in a target zone. Once the ballPlaced[#] value is true for a partiuclar moive clip, the movie clip starts acting in different ways depending on which other balls have been placed in a target zone (i.e. their ballPlaced[#] value is also true).
The 'if' and 'else if' conditional statements are contained within the playVideo() function which is constantly running through the ENTER_FRAME event. [code]...
When I run the following script, the variable userParty is lost between the scoreCalculate function and the bottom of the script, where it should set the value of the quizVariable.party for the URLloader to function correctly.
i can load xml, get what i want out of the nodes, attach mc's accordingly, etc. but i'm having trouble figuring out the best way to build a function for a button inside each dynamic mc that works correctly.I can build the function (which should load the corresponding variable's value for the array's position) but when the button is clicked it actually loads the variable associated with one array index position up.so if i'm clicking on the button that's supposed to load [0], I get the value for [1]'s variable. make sense?ode:
I am having trouble to get the SendAndLoad() function to work correctly so that when the php script echo's or print("result") is called it gets a string saying pass, or fail... the following is my code for php, and action script. Also I have provided two pictures explaining the what exactly I want.
I have a blank container mc into which I am loading JPGs after you click on a button. There are 10 buttons in the movie, each associated with a different JPG.This container_mc is part of a function called on the main Timeline.The Flash movie is 1 frame on the main Timeline. This code works correctly on the first JPG when I click on a button for the first time), but then when you click on a different button I believe it just uses the dimensions and coordinates of the first JPG. How can I reset or refresh (unload, reload) this function so it works correctly every time I load a new JPG?
//after full size image loads into detailthumb_mc, //resize image so that neither width nor height is > 150, tben recenter onClipEvent(load) { var maxWidth = 150;
i have a function that read a variable from a text file, yet i can only read the variable from within the function. How could i create a global variable or such that i can then read from outside of the function.
Code: var Make:LoadVars = new LoadVars(); Make.onLoad = function() { VARIABLE = Make.textVariable;
I thought I understood this stuff by now; the objects within a function are onlyaccessible within that same function, unless you return it to whatever called the function.However I dont think that you can do that for a function called with an eventlistner, so I set up what I thought was a global variable and set its contents within the function, thinking that the contents would be accessible later:
ActionScript Code: var bmpd:BitmapData; var URLReq:URLRequest = new URLRequest("sample.jpg");
I am using a delegate sub-class to perform helper functions for the main app.I have passed all references to it that it needs and it works well apart from the following problem:I also want it to remove an event listener from the main pp.eg:thisStage.removeEventListener(MouseEvent.MOUSE_UP,preOutsideBoundsDragRelease);The compiler tells me I need a reference to "preOutsideBoundsDragRelease" within the removeEventListener statement.eg: "access of undefined property preOutsideBoundsDragRelease
i want to pass by reference so i can use this variable outside the function.
What im doing is creating a global variable such as var cont:int; and then in a eventListener like enter_frame (stage.addEventListener..) calling a function called "mover", this function modifies "cont" value and i just want to print this value modified. The issue is i cant pass the value by reference just by const :S. The function is void, but if i change it to return int, its useless because each time i call the function, the value i want to return its created each time with a new value, beacuse i need to declare it so.. I read i can use a var such as Object but i really dont get it (im used to c++ i have to say)
I am trying to run a function of the main class, but even with casting it does not work. I get this error
TypeError: Error #1009: Cannot access a property or method of a null object reference. at rpflash.communication::RPXMLReader/updateplaylist() at rpflash.communication::RPXMLReader/dataHandler()
I'm attempting to write a performance testing function that can take any function, run it X times and spit out how long it took that function to run in AS3. I've got it working just fine if a function doesn't take any parameters but it comes up with an error otherwise.Here's the code:
public static function testFunction(targetFunction : Function, object : Object, ... parameters) {
I was just wondering if it was possible to get a reference to a function without knowing its name until runtime, in a similar way as getattr() can be used in python?
In AS2 I have several arrays constructed like this : var myArray0:Array=new Array(value,value,value...) var myArray1:Array=new Array(value,value,value...) var myArray2:Array=new Array(value,value,value...) var myArray4:Array=new Array(value,value,value...) ...
What I'm trying to do is use iteration to reference each array name to pass it into a function. Like : function doSomethingWithArray(arrayToPass){ ... } //Later somewhere in For loop... : _root["myButton"+i].onRelease=function(){ doSomethingWithArray(WHAT-THE-HELL-I-TYPE-HERE[i]) }
Say I have a class B that extends class A.In class A, I have a variable that I've declared to be a function, which gets defined in the constructor. Now, in class B, is there any way to reference that function with the use of super.functionName()?
I'm making a function to be called by different buttons, and I want the function also alter the appearance of the button itself. But I don't know how to refer to the button from within the generic function.
How would one get a reference of String global function (not class). According to language reference this function does exist (and I'm ready to believe it does), but, say and you have a:
I have object in which I have rectangle on one layer and following code on another layer:
[Code]...
And Object(this).play() or checking for current frame doesn't work, nor tracing a value define outside the function. How shall I reffer to the movieclip that events is called from?
Once I get logged in on my login control, I would like to change the selected index of my ViewStack. From my outside controls, I cannot reference my ViewStack by name. I can reference a public static function from an outside control however I cannot refer to the ViewStack from within that function.
I got a small problem with a null object reference. The problem is that the function "menuClicked()" not seem to work that good. It works fine if I'm not running it in the cases in the "urlChange()" function. But when I do so I get this error. The urls works fine btw. But I need to run that function to get the right content added regarding to the selected menuitem.
TypeError: Error #1009: Cannot access a property or method of a null object reference. at Main/menuClicked() at Main/urlChange() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at com.asual.swfaddress::SWFAddress$/_dispatchEvent() [Code] .....
I'm wondering how I can create a reference to a function/variable by using strings. Sorry if I'm not explaining the problem well, but let me show you what I mean in an example:You can create a reference to a class using strings by using the getDefinitionByName as follows:var classRef:Class = getDefinitionByName("myClass") as Class;var myClass1:classRef = new classRef();Similarly, how do you refer to functions and variables? The reason why I want to know is because I'm trying to implement a function which takes in the event handler name as the parameter, and what the function essentially does is that it adds an event listener with the associated handler (based on the parameter) to an object, something like this:
public function addListener(handler:String):void { mc.addEventListener(Event.ENTER_FRAME, "on" + handler); }
So I am trying to access a variable that is defined within my parent code from a class which has been called from my parent code. I am using this:Code:TileCode(parent).game_quests.add_quest(0);to try to access the game_quests variable (which is defined within TileCode). However, for some reason it is not picking that up. It is working for other variables which I have called and ran in a similar fashion
In AS2 I have several arrays constructed like this :
var myArray0:Array=new Array(value,value,value...) var myArray1:Array=new Array(value,value,value...) var myArray2:Array=new Array(value,value,value...) var myArray4:Array=new Array(value,value,value...) ...
What I'm trying to do is use iteration to reference each array name to pass it into a function.