I get this error 1120: Access of undefined property OtherClass.
Ths is the code: Code: public class SomeClass extends MovieClip { function SomeClass():void { } public function SomeFunction():void { var i:int = OtherClass.myVar; trace(i); }}
Code: public class OtherClass { public static var myVar:int = 2; public function OtherClass():void { }}
I've been searching this problem for a while and have tried a number of solutions found on google but nothing has worked so far. I'm sure this is a common problem, but due to my lack of flash knowledge I can't logically work through it as I'm used to windows form development, it makes sense to me that the function could access the variables I have defined but they dissapear after the .onLoad event. Does anyone know the common solution to this problem? I want to be able to pass the xml details into the local variables so I can pass on the details into a dynamic text field when movies are hovered over etc
var myXML:XML = new XML(); myXML.ignoreWhite=true; var nav1Text:String;
It seems that with as3, the error compiler is just waiting to get you.I have a function that loads in an external swf. Which swf depends on which button they click. So, it could be pic1.swf, pic2.swf, pic3.swf, etc.
function loadMovie(){ my_mc.addChild(my_Loader); addChild(my_mc);[code].........
When i test, I get "error: access to undefined property myVariable.
I can't access downloaded variables outside the function.I have had this question in forum Actionscript.org but I didn't got a reply that works for me, so I try this forum.[code]...
I have attached the actionscript file on stage, however I can't access function or variables inside movieclip. Instead I can access them on main timeline, is there a way to access function and variables inside movieclip
I've just upgraded to CS4 from CS3, and the AS3 project I'm working on which was compiling perfectly well in CS3, is now failing to compile because of a variety of errors.I can solve some of them by casting:
ActionScript Code: // before if(clip.stage != null) // after if(DisplayObject(clip).stage != null)
But I'm failing to solve them on errors regarding Arrays:
ActionScript Code: // measurements is an array in both cases measurements = measurements.splice(index, 1); // 1180: Call to a possibly undefined method splice. for(var i:int = 0; i < measurements.length; i++) // 1202: Access of undefined property length in package measurements.
I'm surprised than a fresh install is behaving like this. Is there some setting somewhere I've not enabled?I set the flex sdk path to the same one that I'm using in Flash Develop, but no luck.
I'm writing code that takes data from mysql that's processed by a PHP script. It's actually a bit bizarre, at least to me. Anyway, here's some basic AS3 code that's moving toward what I want to do:
var loader:URLLoader = new URLLoader(); var urlRequest:URLRequest=new URLRequest("receive.php"); urlRequest.method=URLRequestMethod.GET;[code]....
For some reason, the statement "trace(evt.target.data);" produces a whole pile of garbled text before the actual stuff that it's supposed to show Because of problem #1, I've had to include a throwaway variable at the beginning, otherwise the first variable I try to pass into AS3 comes back as undefined. This causes errors when I run my flash movie in the IDE, but when I run it from the browser it doesn't seem to have any effect.But this is the strangest thing of all whenever I make any changes to the database (and subsequently try to load data from different variables), the new variables come back as undefined. For example, let's say that I add another entry to the database, and decide to load students 2, 3, and 4 instead of 1, 2, and 3. When I do that, any new data I've added comes back as undefined, even though when I view the PHP output in my browser, it looks just fine.
And now for the REALLY bizarre part: I'll copy that output, paste it into my PHP script as an echo statement, comment everything else out, and my flash movie runs fine. Even though the output from the PHP script is exactly the same, it gives me errors.
I can successfully read in my xml file and distribute its parts as I please, but upon realizing that I would need to include things like line breaks, I made some changes and it all went up in flames. Here is a bit of the xml.
Code: <news> <entry date="June 20, 2007"> <heading title="My first entry!"></heading>
[code]....
I set the htmlText to true for all the text fields that are being influenced, and as long as I don't include any html tags in the xml file, everything works fine. But, as soon as I add something like "<p>", I get "undefined" for all the variables taken in from the xml. Even if I just put one tag in the body, it causes problems with the heading and image.
I have a bunch of variables in a class. There are situations when I want to set then to null/ "temp" etc as per a well defined logic. The challenge is to list out the variables at multiple places- tedious and error-prone.
would prefer a way to refer to these variables programatically and set something like "for all class variables- if variable ends in type, set as "not_set"; for other variables set as NaN How can I achieve this?
A script on my page is causing an infinite loop in FireFox. Here is the Javascript: function expandMothersRings(new_height) { window.scrollTo(0, 0); $('#mr-container').animate({ height: new_height }, 100, function() { // Animation complete. });}
This is being called via ExternalInterface from a Flex object: var tiles_height:Number = 175+Math.ceil(MothersRingData.getInstance().styleArrayCollection.length/4)*175; ExternalInterface.call("expandMothersRings", tiles_height + 300);
There is no issue in IE or Chrome. But for some reason the expandMothersRings function is infinitely looping in FF. The flex object is not expecting any return value from Javascript. Also if I change the JS function to look like: function expandMothersRings(new_height) { alert(new_height); } Then it only executes once. So something in the function is causing it to loop in Firefox.
I am having trouble referencing a MovieClip based on certain variables in my code. I am using Flash Player 9 as the player setting and ActionScript 3.
I have a symbol with a name "Check1" set as a MovieClip, exported for ActionScript, I have ten of these on the stage with an Instance Name of ch0, ch1, ch2...ch9.
Each ch? has 21 frames on the timeline, each with a label name (named with a Number reference "00", "32", etc...) and a different image in each keyframe.
What I would like to do based on these variables:
Code: iTurn = 1; iLeft = 3; iRight = 2;
This is how I would like to use it:
Code: Check1.ch[iTurn].gotoAndStop(iLeft+iRight);
//iLeft & iRight as a frame label and not a frame number, so in the case I would like to access framelabel "32" which is frame 10 on the timeline.
I have tried many way to try and make this work with no luck, the only way I have been able to make it work is by using:
Code: ch1.gotoAndStop("32");
Doing this, I would have 10 clips, each with 21 possibilities. I can do this with many lines of code but I have been unable to tighten it into smaller code.
I have a number of 'TweenField' instances created in a for loop. The problem is that each time the loop increments, the 'myTweenField' variable has the same name, so I don't know how they can be referenced individually from elsewhere in the script. How can I rewrite it so that each instance has a unique name, and how would I then reference it from outside the loop?
I'm having trouble referencing variables in a loaded movie. I read in other posts that you simply refer to the variable as if it belongs to the clip you load it into, however this doesn't seem to be working for me
Hey guys. It's been a while since I've used Flash and I am still trying to wrap my head around Actionscript 3.0 and the way it works; I am so used to the way AS2 works.I have provided the code below, it's very simple, so you might be able to skip this explanation and just take a look at the error and the code:
- I have made a movieclip called HeroMC in my FLA.
- The HeroMC movieclip has the AS Class linkage of exactly the same name, "HeroMC".
- I have made an actionscript class file, HeroMC.as, to house specific variables for my hero; such as Name, Age, xPos and yPos.
- I have also made an actionscript class file, Main.as, the document class for this FLA.
- In Main.as I instantiate HeroMC using the variable hero, and then run the function addHero() from my constructor.
- addHero() is a simple stage.addChild(hero);
This all works perfectly fine and it adds my hero to the stage. However, the problem arises whenever I try to reference one of the variables from HeroMC.as. I am met with this error - I will use the variable xPos as an example.
Here is the error:
1119: Access of possibly undefined property xPos through a reference with static type HeroMC.
It is obvious this is a very simple problem, but I have searched Google, Kirupa and Flashkit for an answer, but none of the threads I find discuss my specific circumstances and I am unable to find the specific information I need to.
I am getting an error that says that 'text_so' is an undefined property and that I can't access it. Yes, I have not declared 'text_so' in 'Reciever.as'. However it is the shared object instance from the 'Text_SO.as' file. How do I reference it from the 'Reciever.as' so that I won't get this error anymore?
Got some external classes, say MyClass.as MyClass.as has a static variable called foo
So, ordinarily in other AS files I can call this with MyClass.foo = bar;
However, this seems to be different in timeline scripts. Every time I try this I get the reference with a static type error 1119: Access of possibly undefined property foo through a reference with static type flash.display:DisplayObjectContainer.
I've tried doing an import MyClass, etc... nothing seems to be firing.
I am trying to display in 'Reciever.swf' the value a shared object updated in 'TextSO.swf' . The following is my code for the Reciever[code].,...
I am getting an error that says that 'text_so' is an undefined property and that I can't access it. Yes, I have not declared 'text_so' in 'Reciever.as'. However it is the shared object instance from the 'Text_SO.as' file. How do I reference it from the 'Reciever.as' so that I won't get this error anymore?
I've got a component written for my app by a third party developer and am trying to integrate it, but I've found a bug that seems like it's either a compiler bug, or there's something with how Flex and static variables work that I wasn't aware of.Basically, I have this:
public class ModeChangeController { public static const DISPLAY_MODE:String = "DisplayMode"; }[code]...
If I use //V2 (i.e. comment out V1), a bug occurs at the startup of the application (some TextFields are uneditable and contains no text), but with //V1 and not V2, it works fine. If I comment out both, that also works fine (I don't get the TextField bug).It took me a while to figure out that it was that static const String that was causing the issue, but I'm still not sure why or if there's something I can do about it except for just moving the DISPLAY_MODE to Events (which is what I've done at the moment, but it's not a particularly nice solution).There are no errors in the log. The order of the includes in my BorderContainer code doesn't matter. I've googled for "as3/flex static initialization order" but haven't found anything.
Clarification: showInitialView() never gets called. It doesn't get there before the other bug shows up. Just having the V2 line there causes the problem.
Update: I've fixed my problem with the TextInput strings not showing: Turns out that adding the component caused the Tahoma font to not show up. However, setting the font-weight to bold fixed that problem, or switching to Arial. With that said, the original question still stands, because when I ran it without V2, it found Tahoma with normal font-weight.
I'm an old C programmer been away from programming for years. Now we have a project requiring Flash and I've been elected. Just installed CS4. I have 16 panels in 4 sets of 4 that rotate left to right. (Big learning curve on that one - fading transitions in the right order...). Each panel must have a unique url when clicked. (16 urls).I've looked through many solutions, most of which seem unduly complex. I think that the simplest short of going to onRelease() with AS2 (Later I have to add mouseover changes in the graphics) is something like this:[code]I haven't found this solution out there. Is there a gotcha because the a#Link vars are accessed as global within the scope of handleLink? It doesn't feel right, but it works fine and 16 global variables doesn't seem too bad.
I really need to reference the variable while INSIDE the onRelease function, because I need to apply some actions based on how many times the button has been pressed.
i was wondering how i would access the desired movieclip's x, and y value from it's function.[code]HOW do i access the x and y values of MC from here like you would use "this._x" in AS2, how would i do that here?
wrote a couple of small games using AS 2.0. One of the things I found easiest about AS 2.0 is that a MovieClip created using _root. attachMovieClip() inside of one function was accessible to every other function. For instance:
This causes an error, because the MovieClip variable was declared inside of a function and when the function ended, the MovieClip variable was erased. Is there any way of doing this without declaring the MovieClip variable outside of the function? I want to be able to create an unknown amount of these movieclips on the fly, so I can't just declare them outside of the function.