ActionScript 3.0 :: Local Variables / Object Need To Be Marked When Set To Null?
Jul 1, 2011
If I have a variable that is declared within a method of a class, should that variable EVER need to be marked for garbage collection (set to null).
For example:
Code:
public class MyClass extends MovieClip{
public function MyClass():void{
//constructor
myMethodThatLoadsAPage();
}private function myMethodThatLoadsAPage():void
[Code] .....
I am making a 24/7 kiosk app and am noticing that the "pages" I load from the library using the above technique continually increases the memory usage (using Monster Debugger 3 and testing the SWF from within Flash Pro CS5 on a Mac.) As I understand it "myVar" are the only references to each "SomeObject" object that gets instantiated. Shouldn't the fact that myVar is local mean that SomeObject should be available for garbage collection after each new page is loaded?
View 8 Replies
Similar Posts:
Jul 1, 2011
If I have a variable that is declared within a method of a class, should that variable EVER need to be marked for garbage collection (set to null).
for example:
Code:
public class MyClass extends MovieClip
{
public function MyClass():void
[code]....
I am making a 24/7 kiosk app and am noticing that the "pages" I load from the library using the above technique continually increases the memory usage (using Monster Debugger 3 and testing the SWF from within Flash Pro CS5 on a Mac.)
As I understand it "myVar" are the only references to each "SomeObject" object that gets instantiated. Shouldn't the fact that myVar is local mean that SomeObject should be available for garbage collection after each new page is loaded?
View 9 Replies
Jun 29, 2011
If I set an Object = null, does that remove all references to the Object's variables assuming there are no external references to said variables? Or do I have to manually set all said variables = null?
View 4 Replies
Mar 14, 2006
I am wrapping my brain around OOP in AS2. I am making two posts on two different subjects. My question here is: when should I use local instance variables, and when should I attach new properties to the instance object? (Feel free to correct my terminology.) Let's say I have a class for a scrolling background, which scrolls when I mouse over its edge. I want to put these values somewhere:
1) How wide is the border in which a mouseOver makes it scroll? This is basically a semi-constant I set it up once and keep it the same, unless the user changes it in an options menu to make the border wider or narrower. Call this scrollBorderWidth.
2) How fast is the background scrolling now? I want to track this so I can smoothly change the scroll speed over several frames. This is often changed. Call this scrollSpeed.
It seems I have two ways I can store and access these values and darned if I know which is better practice. METHOD A: Make them local variables in the class, so the scrolling background instance has them as local vars. I set them up thusly:
[Code]....
View 4 Replies
Jul 18, 2010
the script i wrote is working fine. but the script attached to the flash player which i have no control over is throwing a script error (im using IE8).how can i fix this? if i run it locally there is no error.
'null' is null or not an object
try { document.getElementById("").SetReturnValue(__flash__toXML(function() { return document.location.hostname; }()) ); } catch (e) { document.getElementById("").SetReturnValue("<undefined/>"); }
but this is from flash script and i dont have control over it. it just say JScript - script block.
View 1 Replies
Sep 15, 2010
I have the following piece of code(part of a much bigger program). I this code I am re-using a motion that has been previously used successfully. The trace stmts are used to identify the exact location of the error and the error conditions as best I can.[code]
View 4 Replies
Mar 6, 2012
When you cast null to an object using Object(null), the result is an object.When you cast undefined to an object using Object(undefined), the result is an object.But saying null as Object or undefined as Object remains null.Why is this? I can't find anything in the documentation about this.
The objects that result from these casts can have properties set on and read from them. It's as if the cast created information, or removed whatever special information the null and undefined values have. But there's no indication in the AS3 documentation that the null and undefined special types are actually objects.
View 2 Replies
Sep 5, 2009
I am trying to add an EventListener to a MC, but I am getting the 1009 error. My script is referencing a MC that does exist. I have verified that my code is typed correctly, and that my instance names are correct.I am creating a portfolio site. On the first frame I have my main navigation (well, it's actually not the first frame. I alpha-fade everything in so it's really the 6th or 7th, but I'm not sure how pertinent that is). The main navigation works fine (5 movie clips, fyi). Clicking them will move to a different frame, and the information and sub navigation for the frame will fade up. It is the sub navigation that I am having trouble with.[code]
As you can see, it doesn't even get to the function before it gets thrown off. I have verified that the instance names are correct. The script and the MC I am trying to add it too [I/]are[I/] in the same frame, which is what's stumping me. Normally you get 1009 when the object you're trying to reference is not there, but mine is!!Obviously there is something wrong with my EventListener. I am not sure what else do; there is a gap in my understanding of AS.
View 8 Replies
Feb 22, 2011
I have an object which is assigned a number of properties:
var project_array:Array = [];
var slideObject:Object = {
project_title : myXML.projects.project[i].title.toUpperCase(),
[Code].....
but I'm not quite sure where to place this. If I place it outside of the object constructor, I get "term is undefined", I guess because it doesn't know what project_clips_array is - but if I declare project_clips_array in the constructor, it appears to need to be defined, i.e. I can't create a blank property. But I can't place it in the constructor either, because it doesn't seem to allow me to run a function within an object constructor. What is the proper syntax or arrangement of code for executing this function to get the array within the object?
View 2 Replies
Jul 23, 2011
i am trying to access an object within a class and the object is comming up as null but i dont understand why.
this is the object:
btnLMain = new MovieClip(); //variable declared earlier in code
btnLMain.name = "btnLMain";
[Code].....
View 2 Replies
Sep 24, 2009
from a url like this:Code:index.php?survey_user=83a3q7b8&survey_password=h44e954s'm getting NULL for both variables.My code:
Code:
vid.source="video/skeeter.flv";
vid.addEventListener(Event.COMPLETE, nextMovie);
[code].....
View 1 Replies
Jul 4, 2010
I'm trying to load a local xml file:
xmlLoader.load(new URLRequest("../xml/xmlData.xml"));
But I'm getting this security sandbox violation:
#2148: Only local-with-filesystem and trusted local SWF files may access local resources.
I don't get this error when I embed the XML file directly with the EMBED metadata tag.
View 3 Replies
Aug 22, 2011
I have one MXML File as
<objecthandles:ObjectHandles xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" backgroundAlpha="1" xmlns:mx="library://ns.adobe.com/flex/mx"
[code].....
View 1 Replies
Jul 23, 2011
i am trying to access an object within a class and the object is comming up as null but i dont understand why.this is the object:
btnLMain = new MovieClip(); //variable declared earlier in code
btnLMain.name = "btnLMain";
btnLMain.clickNum = 0;
addChild(btnLMain);
this was created in the class: LanguageButton. here is how i declared the above class within the class i am trying to instantiate it:
var btnL:LanguageButton;
then i try to access the btnLMain from the LanguageButton Class and it, (btnLMain) is comming out null:
btnL = new LanguageButton(cssLoader);
main.addChild(btnL);
btnL.btnLMain.addEventListener(MouseEvent.CLICK, btnLClick);
View 2 Replies
Oct 26, 2011
I was given the task of altering a Flash animation (no AS) in a way that it would collect data from WSDL, write it to a text file and then use that data each subsequent time it runs.
You see, the Flash animation is part of a playlist (digital signage) and has a set duration which doesn't allow for network problems while retrieving data from WSDL. So while I got it to work fine by just displaying the WSDL data directly - it sometimes times out.
I have the retrieving from WSDL part down (flex), I can even read stuff from .txt files, but can't do the middle part - writing the variables into a .txt file.
View 2 Replies
Jun 5, 2010
I followed less second tutorial on AMFPHP+MYSQL+Flash; I got the data from MYSQL database and AMFPHP loaded in flash; and I was able to trace these as separate variables and then display them in dynamic text boxes in flash, however when I upload my .swf and html page etc to my website it doesn't load the variables in the text fields they just stay blank and I am left with a blank background. I just want to show my friends what I've accomplished today; as I've only been using Flash/AS3 for about three weeks now; I can only do this by uploading it to my website but it wont work once I've uploaded it there.
View 2 Replies
Feb 15, 2011
Do you have to remove event listeners on variables with local scope? By this I mean...does the event listener still exist if the variable only exists as long as the function/method is running?
private function startSomething():void
{
whatever.start();
[Code].....
View 2 Replies
Mar 4, 2009
I'm working on a particle system, where each single particle is represented by a movie clip and has it's own behaviors, defined in the movie clip's code in a separate layer from the image. The particle creates local variables, such as it's gravity and color, in the first frame and then uses them to guide it's actions throughout it's lifetime (it fizzles out and dies, eventually).Frame 1 of particle_mc:
Code:
var gravity:Number = 0;
var color:Number = 2;
[code]....
View 2 Replies
Jun 8, 2010
I am having a situation with my actionscript/flex front end.
[Code]...
I am expecting to have 3 Alert windows containing A, B and C. But the actual result is 3 alert windows all showing C
View 1 Replies
Feb 11, 2010
I am using the Flex Builder 3 debugger almost every day and it's starting to be a real pain that the 'Variables' tab in the 'Flex Debugging' view doesn't show local variables, only 'this' is displayed.
Also I can not add Watch Expressions for local variables.
Am I forgetting something here or is the debugger just very limited?
View 3 Replies
May 31, 2009
I have problem with accessing object created by function imported from another package.
I have 2 packages DragDrop and UserInterface. In UserInterface I create methods for buttons and later add them in DragDrop . I make it in two different ways:
One(this one works):
[Code]....
View 6 Replies
Feb 2, 2011
i've had good feedback and help from these forums before so thought i'd pick your brains again...
I'm looking at making a sim/game based around random results. The experiment im supporting has (for example) 100 rubber ducks in a bag, you pick out 30 and mark them with a cross and place them back in the bag. Then you pick another 30 and note how many of the marked ducks you have found again.
I have some knowledge of Flash and have managed to make a random dice simulator and a few others. I figure the best way is to forget about manually marking the ducks but instead have a drop down box where you can sellect how many of the 100 will be marked.Then have an action button which produces the results (in numbers?) underneath each corresponding duck (1 normal yellow, one marked).
View 32 Replies
Nov 9, 2011
I have a .fla and one.as(DisablingButtons.as).The .fla currently has only one key frame and three movie clips.First movie clip has base class flash.display.MovieClip and class DisablingButtons.as.The other two movie clips have base class DisablingButtons and their own classes (set by flash on export). The movie clips have identical timelines, 20 frames, two motion tweens, and the only action is stop();on frames 1,5,10,15. I get two errors:5000: The class 'DisablingButtons' must subclass 'flash.display.MovieClip'and 4 copies of 1024: Overriding a function that is not marked for override (on frames 1,5,10,15 of movie clip #2)
I am importing flash.display.MovieClip and have public class DisablingButtons extends MovieClip.Code below...[code]..........
View 2 Replies
Mar 29, 2012
Keep getting this error in a flash instrument im making. 1024 overriding a function that is not marked for override
View 2 Replies
Apr 21, 2008
How can I direct a button placed in one mc to play a marked keyframe in another mc. Here's what I'm trying to do?
on (press) {
gotoAndPlay(_root.animMc, "go");
}
View 2 Replies
Apr 13, 2011
anyone has any tips about why i have these yellow marked classes in my actions panel?
View 3 Replies
Jan 28, 2010
Does anyone know if it's possible to save and access a LSO from an EXE projector on a CD?
Obviously the LSO couldn't be saved on the CD itself - would it be able to save the LSO somewhere on the users hard drive?
View 4 Replies
Sep 1, 2011
I'm trying to override dispatchEvent(), with no success in the Flash IDE. Reviewing Adobe docs on the method, it should simply be:
override function name()
As demonstrated by Grant Skinner, this is commonly and easily performed:
override public function dispatchEvent(evt:Event):Boolean {
// code here
}
And while a thorough google search will repeat this syntax successfully used in Class files, doing so inside timeline code, natively in the Flash IDE is proving impossible. The first issue being that the use of public throws the error 1114: The public attribute can only be used inside a package.That was obvious, however upon removing that, running the following (on the first frame of a new .fla file):
override function dispatchEvent(evt:Event):Boolean {
trace(evt.type);
return super.dispatchEvent(evt);[code]..........
results in this error: 1024: Overriding a function that is not marked for override.
Documentation on this error implies that I failed to prefix the identically named function with the override statement, but obviously that's a fallacy, and I'm left flabbergasted as to what the solution may be.
To be clear, we know a class file will work, but that's an irrelavant issue. How do we get override function dispatchEvent() working in timeline code?
View 2 Replies
Oct 7, 2011
I have got an open source "Organisation Chart" component in Flex from the below link [URL]..But the component is in Flex 3, and I want the same in Flex 4.When I am trying to run the same in Flex 4, I am getting some weird errors :
1024: Overriding a function that is not marked for override. OrgChart.as
Any one has any idea, Please help me with this.Also If any one knows any other "Org chart" component for Flex4, Please let me know.
View 1 Replies
Oct 21, 2009
As the title suggests, why are the applyResult and applyFault methods of AsyncToken marked mx_internal?There have been a few times that I would have liked to use AsyncToken in my code, but I've ended up re-writing it because I don't want to force clients to use namespace mx_internal.
View 1 Replies