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];
[Code]....
View 5 Replies
Similar Posts:
Jun 3, 2009
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]...
View 1 Replies
Feb 2, 2010
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.
[Code]...
View 9 Replies
Aug 25, 2005
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:
Code:
stop();
holderMc._visible=false;
[code]......
View 3 Replies
Apr 28, 2007
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.
[Code]...
View 3 Replies
Sep 1, 2006
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;
[code]....
View 2 Replies
Mar 2, 2010
Is there a way to reference a function via a variable? In other words, instead of saying something like:
var theVar = someString + 'function';
if (theVar == 'functionName') functionName ();
to access it directly:
(someString + 'function') ();
using some kind of bracket notation?
View 1 Replies
Apr 9, 2010
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;
[Code].....
View 1 Replies
Feb 5, 2011
What's an example of calling a function through a reference (as opposed to directly)?
View 2 Replies
Jan 30, 2012
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");
[code].....
View 5 Replies
Sep 16, 2009
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
View 1 Replies
Oct 20, 2010
I got this document class Main and a navbutton class. How can I connect a function from one AS3 document to another like this:
navbutton.as
removeObjects();
Main.as
function removeObjects(){
//code
}
I get this error: call to a possibly undefined method removeObjects.
View 5 Replies
Mar 29, 2011
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)
View 3 Replies
Feb 10, 2010
Ok, I have a class like this:
public class Foo extends Sprite {
public function Foo(x:Number, y:Number):void {
this.x = x;
[Code]......
I'm getting this error from the compiler: "Error: Illegal assignment to function bar". How can I change the public function bar on the fly?
View 2 Replies
Mar 23, 2010
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()
[Code].....
View 2 Replies
Aug 17, 2010
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)
{
[code]........
View 1 Replies
Sep 22, 2010
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 python you can use it like this:
Code:
getattr(li, "pop")
rather than
[Code].....
View 4 Replies
Nov 12, 2004
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])
}
View 2 Replies
Jun 1, 2005
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()?
View 1 Replies
May 22, 2008
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.
[Code]....
View 2 Replies
Feb 4, 2011
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:
Code:
function foo(bar:Function):void { ... }
How then would you pass that String to it?
View 9 Replies
Mar 18, 2011
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?
View 2 Replies
Jan 5, 2012
This is my code in Flash/AS3, in a frame's action:
import flash.events.Event;
stop();
this.addEventListener(Event.ENTER_FRAME, loading);
function loading(e:Event):void{
[Code]....
This is because I believe it is referring the splashTimer1 function by "this".
How can I refer to parent frame there, so that I can remove its event listener.
View 2 Replies
Feb 28, 2012
Is it possible to reference a control in an application from a static function?
What I have is a Viewstack containing VBoxes stored in separate controls. Ex:
<mx:ViewStack id="content" width="100%" height="100%" resizeToContent="true">
<controls:Login/>
<controls:Dash/>
[Code]....
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.
View 3 Replies
Apr 26, 2010
I am using foll0wing code to fetch data from XML file to flash.
Code:
function xmlLoad(fileName:String){
var pagedata:XML = new XML();
pagedata.ignoreWhite = true;
[Code]....
The problem I am encountering is that when I call function "createVar()" it looses the stage reference and "pagedata", my xml object.
View 0 Replies
Jan 12, 2010
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] .....
View 2 Replies
Apr 4, 2008
I'm trying to do something like this, but for some reason it isn't working...
Code:
function mouseClickHandler(t:MovieClip):Void
{
if(!t){
[Code]....
Hmm, I replicated this situation in a blank movie and it works as it should.
View 2 Replies
Sep 18, 2009
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);
}
[code].....
View 3 Replies
Sep 19, 2011
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
View 7 Replies
Nov 12, 2004
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.
[Code]...
View 2 Replies