Actionscript 3 :: Dispatching From An Object Not In The Display List?
Feb 24, 2011
I have an object that controls another object that is on the display list.
The setup looks like this:
Parent (Main Timeline)
- Child
-- Grandchild --> contains instance of behaviour class that controls the grandchild's movement
I have an event in the "behaviour" that I'd like to reach the parent, but the behavior does not extend Sprite or MovieClip.
How can I get this event to reach the parent?
View 2 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
Mar 4, 2011
What's a simple way to detect if a display object is currently on the display list?
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
Oct 4, 2010
i have this really basic class and all it does is create a button...i have another class called main where i want to put the button on the stage...problem is it all compiles but can't get the button to display..
public class Main extends Sprite
{
public function Main()
{
[Code].....
View 6 Replies
Oct 7, 2010
Is there a way to make a display object always be at the top of the display list?For example, I know you can set the childIndex, i.e:setChildIndex(myDisplayObject, numChildren-1);But is there a way that an object has sensed that something else has been added to the display list and restack themselves accordingly?
View 2 Replies
Jun 14, 2009
When a movie clip is removed from the stage it's properties are still accessible including visible == true. How do I test to see if it is off the time line?
View 9 Replies
May 10, 2011
I have an application that uses a main class to control other MovieClips, adding and removing them as needed, most of them are separate screens or sub menus.
When I leave the main menu and come back to it later from another screen, certain animations and roll over buttons still play, which I don't want, I basically need the main menu screen to reset every time it is seen.
I read up on this and found out that removing the child doesn't necessarily remove it from the memory.
I tried setting the mainmenu to null before moving onto a different screen but this threw up an error, stating that the parameter child must be none null.
how to completely kill my mainmenu when it is not needed.
public function confSubMenuOneScreen():void {
subMenuOneScreen = new SubMenuOne();
mainmenu = null;
[Code].....
This is the example of code that removes the menu and adds another screen, with the mainmenu = null code that throws up the error.
View 1 Replies
Nov 28, 2008
Any command to check whether an object is currently present in the Display List? I have a TextField called _startHereText. I have some logic where I need to sometimes use RemoveChild to take this object out of the Display List, but I first need to determine if it is presently there.
View 9 Replies
Sep 21, 2009
For some reason below is not working. It is probably very obvious but I am not seeing it. As soon as I comment out the container mc variable and just add Child to root timeline I see everything which means me container is not being added to the stage correctly.
stop();
import flash.display.MovieClip;
var i:int = 0;
var a:Number = 10;
var ageString:String;
var ageText:Array = new Array();
[Code] .....
View 7 Replies
Jun 7, 2010
I'm trying to dispatch a custom event from a custom class (which implements IEventDispatcher) to another custom class (also implements IEventDispatcher) but I cannot trigger the corresponding event handlers.The classes are instantiated at different parts of the application: one on the main canvas and the other on the back-end (data side) of the app. Neither of these is part of the display list hierarchy and I need them to communicate through events.I've looked through adobe docs, the web and Mook's Essential AS3, but have come up with nothing...
View 4 Replies
Jul 12, 2009
I need to access a non-display list top-level (Parent? Ancestor? What's the correct term?) object from a display list object, and I don't know how.
In my code, ResultX is an instance of my custom class Result. Card is a sprite, a visual representation of the ResultX object, defined inside the Result class and attached (or removed) to the stage via a separate function inside the result class as needed.
I want to refer to the correct Result object when the user clicks on the corresponding card to call a function there. In accessing the sprite manually, ResultX.card works fine, but I don't know how to go upwards trough the path - card.parent (or actually target.parent, since it's done via event) just returns Main, of course.
View 3 Replies
Dec 8, 2009
I'm trying to create an image class that I can reuse throughout a website I'm making.
When you click an image i want it to expand to fill the screen. When this happens obviously it will have to be at the top of the display list so that none of the other objects on the website are above it. The problem is that I want to be able to use this class throughout the website, even within containers that are beneath other objects so it seems impossible to simply bring it to the front easily?
Edit: Maybe when you click an image it would create a replica on top of the current image but above all the other objects on the main stage - then expand that one instead of the original image in the container? Theres got to be a better method though... I can't imagine this working too smoothly.
View 4 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
Oct 1, 2011
i have made a list control. i want to display the name of the objects in it in a text control box
the code i am using here is
public function add(event:MouseEvent):void
{
var str:String;
str = mylistcontrol.dataProvider.getItemAt(0).toString();
[Code]....
The problem with this code is i am using index value of 0. however i want to display the name of object on which i have clicked or which is highlighted.
View 1 Replies
Nov 16, 2010
I've got these Flash students I TA for a course, and they are doing drag and drop exercises and have come across some weirdness.(They are using a frames based design to represent different pages of activity, with a menu to goto each frame under user control.)At author time:
1. they set up drag and drop as3 for an object on a particular frame.
2. when startDrag is initiated, they moved the dragged object to the top of the display list, so it appears to float above all other objects as the user drags.
at runtime,a problem appears:the object seems to have been pulled out of the frame, and now floats in a display list above any frame that may be advanced to.What's going on here? It's like the object got pulled off the authortime stage and now is disconnected. Going back to the drag and drop frame shows the original object again, reinstanced, along with this copy that got pulled out.
View 9 Replies
Oct 18, 2010
If an asset (say an swf) is already loaded. Does it increase memory use to add and object to the display list?
View 4 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
May 9, 2010
When I'm removing an object from the display list (via removeChild), I'm performing a splice on all of the arrays that the object has:
[Code]....
My thinking was that this frees up some memory similar to disposing a bitmapdata. Does this even do anything? Or, will arrays be cleared and the memory usage restored when the object is removeChilded?
View 3 Replies
Sep 12, 2009
This happens to be a really difficult question to ask.And maybe the answer is terribly simple and I have simply overlooked it. Happens all the time. ay you have a non-visual class (one that does not reside on the display list). This custom class, thru composition, will have a property that is a visual class that DOES reside on the display list. This custom class will also implement IEventDispatcher. So how do I do this:
Code:
public class MyNonVizClass implements IEventDispatcher
{
[code]......
View 3 Replies
Nov 15, 2011
When dispatching events in as3 I always have to extend class from sprite, or movieclip, but when I don't have display objects I don't wont to extend to sprite or movieclip. What is the most light class that I can extend, I mean no display object, and still do use event dispatching?
View 1 Replies
Jan 31, 2010
If I create a rectangle with 100px width and 100px height and then rotate it, the size of the element's "box" will have increased.With 45 rotation, the size becomes about 143x143 (from 100x100).Doing sometimes like cos(angleRad) * currentWidth seems to work for 45 rotation, but for other bigger angles it doesn't.At the moment I am doing this:
var currentRotation = object.rotation;
object.rotation = 0;
var normalizedWidth = object.width;
[code].....
View 4 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
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
Jan 22, 2012
can I resize a display object (container) without its contents (children) are resized?
For example, in the following code when I resize the green square, red is also resized. I wanted to resize only the green.
ActionScript Code:
import flash.display.Sprite;
var sprite:Sprite = new Sprite();
sprite.graphics.beginFill(0xff0000);
[Code].....
View 3 Replies
Aug 14, 2009
Can you make one Bitmap Object (I'm using an external jpg) or something similar, and then display it many times simultaneously without creating a separate object each time?
Also, would they be easily removed or hidden?
I've got a little checkmark jpg graphic loaded here, but I'm not sure how to go about using it in many places at once.. I can only display it in the one place at any one time...
I'm thinking there might be a way to load the picture once, then use its bitmapData elsewhere in new display objects somehow, without needing to reload the image over and over?
View 3 Replies
Jun 2, 2009
I'm having alot of trouble tracking down the name of an object on the display list so i can removeChild Is there a way to trace every object on the display list so i can get its name and remove it? my stage is changing dynmically and i can't jut trace each object through a whole whack of code.
View 4 Replies
Nov 6, 2009
I have a list box in my flash file that I would like to display a string from an xml file that has been run though html entities in php. So for instance I need the string.
Code:
Hey "Leonardo£$£$()*%£% '"' [1999]
to display as
Code:
Hey "Leonardo;$;$()*%$% '"' [1999]
I can get this to happen in my dynamic text boxes by using .htmlText to display but I have no idea how I would do this in the list box?
View 1 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