ActionScript 3.0 :: Dispose A Class Which Doesnt Get Added To The Display List?
Oct 22, 2009
how do you dispose a class which doesnt get added to the display list?
instantiate:
Code:
var myClass:Class = new Class(parameters);
do you just say this?
dispose:
Code:
myClass = null;
View 1 Replies
Similar Posts:
Mar 6, 2008
Is there any way to test if a display object has been added to the display list?
View 9 Replies
Jan 20, 2010
I've got MovieClips on the stage, both manually added, and added with code. I used this code to trace them all:
for(var i:int=0 ; i<stage.numChildren; i++) {
var myObject = stage.getChildAt(i);
trace(i);
trace(myObject);
}
All it returns is 0 and [object MainTimeline]. Is there something wrong with Flash, or did I do my coding wrong? The objects I put on the stage should be on the Display List, right?
View 5 Replies
Sep 14, 2010
I'm instantiating a group of RadioButton components into a Sprite and then later adding it to the display list. When the latter occurs, I can visibly see the font of the RadioButtons' labels changing from a serif to sansserif—but I have NO code to that effect anywhere. This occurs long after the components are actually instantiated, when they (via their parents) are added to the displaylist.
In Question_UI.answersContainer.answer:
answerUI = new RadioButton();
answerUI.group = rbg;
answerUI.label = text;
[Code]....
I've triple-checked the obvious, but there's NO code regarding the font of the label at all. It seems to only have to do with being added to the displaylist.
View 2 Replies
Jan 13, 2009
I am overlooking something, but why won't my FLVPlayback component, which is in my library, be added to the display list? When the code executes, there is now FLV component on stage.[code]...
View 1 Replies
Nov 3, 2011
I have an object that is instantiated, then placed into a property within a singleton (single instance) object. When a button is clicked an event is dispatched carrying a payload that references the display object that is held within the Singleton. When the event is heard, my view object adds the object to the display list e.g. addChild().The Item shows. Now If I hit another button an event is dispatched, and a new item is added to the display list via the method above and is seen. The 1st object is removed from the display list Here is my problem. When I click the button to load the 1st Object the above process is executed again but the object does not show.
I can run trace statements from the object that is supposed to be visible and they run fine. I even do a check to see if the visible property is set to true, and it is, but not object is on my screen. Code for this process.
//custom event carries the name of the page aka display object. this is a string
dispatchEvent(new MenuEvent(MenuEvent.CHANGE_VIEW_STATE, event.payload));
//When the event is heard, the following condinial is run
[code].....
View 3 Replies
Aug 22, 2010
how do we remove object( sprite which has an external swf as it's child ) from display and more importantly from memory yet we still can use the same variable to add another object (yes another sprite like the one we removed yet has different content).., "
i did tried the removeChildAt thing it did remove all the child from the display list but i still can hear sound from video running.
here is small scale code of what i'm doing (sorry that i can only give you chunk code of loading and adding)
// var SWFList:XMLList; //used to hold a list of all external swf source,atribute and etc// var totalSWF:int; //hold the total number of external swf there is to be loaded
// var swfLoader:Loader; //instance of loader class used to load the external swf
[Code]....
View 11 Replies
Sep 14, 2008
in my Main.as file, this works as expected:
var t:TextField = new TextField();
t.text = "hello in main";
addChild(t);
However, when I create an instance of a class, and I have that same code in the constructor of that class, the text doesn't show up. I am creating the text field variable at the class level, not the contstructor level, so I think the variable should still hang around.
Do I have to get an instance of the stage, or something?
View 3 Replies
Feb 1, 2011
Do you need to have a destroy/dispose method on your Document Class? Say I have a Document Class that has the following
- mouse event listeners
- timers running and or enter_frame listeners
- class variables
Do I need to have a destroy or dispose method that:
- removes event listeners
- stops timers
- nulls class variables
Or is this only something I need in other objects (sprites, movieclips) that are added to the stage of the Document class?
View 2 Replies
Dec 14, 2009
What i'm trying to do is create an errorAlert class. The role of this class is to as you might expect display an alert:) So the current class is set up in such a way.
1. pass in an errorcode returned from the server into the constructor.
2. This runs through a switch and sets a msg variable to the right textual prompt based on the code. At this stage it also sets an alert type, so as an example it could be a severe alert where the user has no option other than ot refresh the browser. Or it is a softer alert where the user is able to press a close button and proceed.
Because all of the type handling and everything is held within the class. I want to avoid adding the instance to the display list within the main document class. Ideally just letting the class add itself to the stage AND IF it is a softer alert, it can show the close button, add an event listener, and, then remove itself.
View 3 Replies
Feb 3, 2010
I have very simple code for a class: package {import flash.text.TextField; import flash.display.Sprite; public class Greeter extends Sprite { public function Greeter(){var txtHello:TextField = new TextField(); txtHello.text = "Hello World"; trace("hi"); addChild(txtHello);}}}
The above file is saved as Greeter.as in say folder C: est I then create a Fla file named test_display.fla (saved in C: est) and its contents are: import Greeter;var tt:Greeter = new Greeter(); Now the Output window shows hi due to the trace statement but the addChild method should show World in the Flash movie but it does not. The only way to get Hello World to the Flash Movie is to change the test_display.fla to:
import Greeter;var tt:Greeter = new Greeter(); addChild(tt);
In other words I have to use the addChild method twice ( once in Greeter.as and once in test_display.fla ) to get Hello World to display in the Flash movie. Does anyone know why this is so?
View 5 Replies
Feb 26, 2010
I am trying to pass the display list name that is inside the trace statement back out of this class. Essentially I what I want, is that when someone clicks on the "Button_mc" movie clip, I want to pass the instance name back to a different class I've been trying to figure this out all day with no luck and I was wondering if someone would be willing to give me a hint.
package { import flash.display.*; import flash.events.*;
public class button_mc extends MovieClip public var
current_button_name:String;
[code].....
View 1 Replies
Aug 15, 2010
Say i have these two classes:
MAIN.as
package
{
import flash.display.*; import mx.core.*;
import flash.events.*; import mx.collections.*;
[Code]...
Now how is it that I can add the variable SPRITE which is a Sprite in the OBJECT_square class to the display list of MAIN class? I've tried addChild(SPRITE) and super.addChild(SPRITE). If everything works I should see a red square somewhere on the screen but right now its all blank, except for the text drawn in the MAIN class.
Basically I want it so i can just make a new OBJECT_square and it will draw itself without any more instructions from the MAIN class.
View 2 Replies
Aug 18, 2009
I found myself loading a new XML file every day and so decided to create a small class that will load the xml file and return it.The class is loading the file but when i try to return it to a new xml object in the document class it doesnt load it.I think that it's something to with the return being in a nested function but i tried a few ways and non seems to work.
[DOCUMENT CLASS]
loadXML:LoadXML = new LoadXML();
myXML:XML = new XML(loadXML.loadXMLFile("gallery.xml"));[code].....
View 1 Replies
Mar 13, 2008
my preloader doesn't display until about 60% loaded?
stop();
textVar = "..::LOADING::..";
loaderInt = setInterval (Lbar,10) ;
function Lbar () {
[Code].....
View 2 Replies
Feb 9, 2010
so I need to know if there is a way to understand if an Object has listener added to it. I mean:
myObj.addEventListener(event.ENTER_FRAME, handler);
listenerList:Array(?) = myObj.function_I_need();
View 1 Replies
Aug 5, 2011
I have a list containing display objects from throughout the application (insertion order). I want to process the list either top-down (parent, child) or bottom up (child, parent). The only requirement is that either a parent is processed before any child or vice versa a child before its parent. What is a good approach? This question is not about sorting a list. It's about retrieving the depth of a particular display object.
Example
Display list:
A (root)
B1
C1
C2
D1
B2
......
My list:
list = [E1, F4, A, B2, B1, C3, ..., N9, N8]
Bottom-up:
N9, N8, F4, E1, C3, B2, B1, A
Top-down:
A, B2, B1, C3, E1, F4, N9, N8
Does not matter if N9 before N8 or N8 before N9. Important is that any N is before M (first run) or any M before its children N* (second run).
View 2 Replies
Feb 6, 2009
Is there any way that I can clear all of the previously added items within a List?
View 4 Replies
Mar 4, 2011
What's a simple way to detect if a display object is currently on the display list?
View 1 Replies
Jun 28, 2011
How do I identify all the display objects in the display list in ActionScript, bellow the one that I have clicked? All the other objects are shadowed by the first one. What if other objects have visible parameter as hidden?
View 1 Replies
Jul 8, 2011
I was wondering if there is a shortcut so i can always set a MovieClip to display at the tippy top of the display list?
Also i understand that WebViewLayer will always display above the display list.
View 1 Replies
Dec 2, 2011
This is my first time working with a class attached to a movieclip that is nested inside a class attached to a movie clip.I've tested all the properties and methods of PTListItem.as and they work properly but when I try to call them on the list item through PTListTop.as it returns undefined.The end goal is to dynamically load a checklist via a txt file.
View 1 Replies
Oct 6, 2010
I have a Spark List (spark.components.List) backed by an ArrayCollection for its dataProvider. The List has a vertical scrollbar when there's too many rows to display. What I want is when a new row is added to the List for it to scroll to the bottom to show that new row.
I've tried calling List's ensureIndexIsVisible from a listener on the ArrayCollection. This doesn't work because the List hasn't yet fully rendered the new row. It will either scroll to the second from the last row, or throw the exception:
[Code]...
View 3 Replies
Jun 20, 2011
I have an (empty) ArrayCollection that I wrap with a ListCollectionView. Then I add a series of items to the ArrayCollection, but these are not showing up in the view.
public var transactions : ArrayCollection = new ArrayCollection();
public var filteredTransactions : ListCollectionView = new ListCollectionView(transactions);
transactions contains 150 items, filteredTransactions contains none. I originally thought it was the filter I was applying, but even when I remove the filter, I still get no items in the filtered list.
Do I need to add the items to the view as well as the underlying collection (this would seem to defeat the purpose of using a view though...)?
View 1 Replies
Feb 9, 2009
It's my understanding that a display object cannot be in the display list more that once.So if I add something to the stage shouldn't a second addition of the same object replace the first? for instance:
[code]...
there should now only be one "myDisplayObject" on the stage.
View 3 Replies
Apr 30, 2011
I am building an AIR application and I was planning to include the mx:HTML control but I can't seem to get the control to display. Here is the code:
var tmpHtml:HTML = new HTML();
tmpHtml.htmlText = "<a>This is the sample </a>";
tmpHtml.x = 48;
[code].....
View 1 Replies
Feb 21, 2011
The site operates around a swf named main.swf. All the different content areas are external swfs called by a navbar in main.swf. One of the primary content areas is a gallery of our work, with five separate types; branding, package design, collateral, Internet, and Digital. The left hand swf for the Gallery section contains five movie clips that let you select the specific gallery area that displays on the right hand side. Included in the right hand area are thumbnails (movie clips) that when clicked she wants a Greybox-like slide show to appear over the entire area (1100x x 690), INCLUDING the main.swf. As I currently envision it, this is an 1100 x 690 XML-driven portfolio swf, with the alpha of the overall stage box at about 30%, and the actual gallery centered.
If I haven't lost you, my challenge is to call the slide show swf from a click event in the thumbnail on the right hand side. If I understand the Display Object Model this swf is about three levels removed from the stage.
How do I call the slide show swf that must be added ABOVE the main swf in the Display List from a click on the right hand area thumbnail?
I'm gaining a better understanding of classes, and am using them to hold all the AS for the external swfs. Basically I need to be able to talk to the main swf from the brandRight.swf which is the right hand swf containing the thumbnails.
View 9 Replies
May 3, 2010
I have a class called shapeC that only creates a rectangle and then addChild(rectangle);. That class is instantiated on the main timeline. Currently, the only way you can see that rectangle is to add the instantiated class to the stage via addChild(shapeC);. My question is, is there a way that the shapeC class can add the rectangle to the root stage without requireing the instantiated class to be added to the stage?
View 4 Replies
Jun 18, 2009
when I create a variable like [code]does that get rid of the Sprite that was formerly held by s or is it just going to stay in memory?
View 3 Replies
Apr 15, 2010
1) I want to count the number of movieclips(in different class) added. That is, may be I have 10 clicks, how many bigfish and smallfish are created. What function is suitable to call for doing this.
2) I have a problem on the hittest, it comes out "no hit" only but I still can see the movieclips overlap. And if I want to modify that only check whether smallfish is overlap with bigfish, what should I do? Also, there are functions inside the movieclip itself to give motion.[code]
View 1 Replies