ActionScript 3.0 :: Can Non-display Objects Listen For KeyboardEvents

Apr 11, 2009

Can non-display objects (or display objects that are not attached to the stage) listen for KeyboardEvents?

I know this question or similar questions appear all the time, but is there any official solution or answer?

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Listen For Objects Created By AddChild?

Feb 10, 2010

i created a "for" function who ´ll display an X number of buttons with addChild, and give a name for each using button.name = "name" + variable but later if I want to listen for the buttons using their name don´t work, already know that there is getChildByName so i tried but give me the same error who tells that there no object with that name.My question is, how i can listen for the objects created if i already have a name for each one of them? here is the code im doing.
 
for(var i:int = 1; i <6;i++){var miBoton:boton = new boton();var miTexto:TextField = new TextField();miBoton.x = i * miBoton.width + (i* 10);miBoton.y = 20;addChild(miBoton);miBoton.name = "boton" + i;miTexto.text = "hi";miBoton.addChild(miTexto);trace(miBoton.name);trace(miBoton.parent);}

View 6 Replies

Actionscript 3 :: Listen For Changes In A Flash.display.DisplayObject Visibility In A Loaded SWF?

Feb 16, 2010

I'm loading an external SWF (pre-made by an other department of the company I work for) using flash.display.Loader. I then traverse the display list, register all objects and listen for added/removed events to handle future changes to the list.

var obj:DisplayObjectContainer = loadEvent.currentTarget.content as DisplayObjectContainer;
var count:Number = obj.numChildren;

[Code]....

Is there a way I can listen for changes to the .visible property? Or any other property (that doesn't fire a built-in event) for that matter?

View 4 Replies

ActionScript 3.0 :: Listen For Events Coming From Concrete Objects Made By A Factory?

Jul 29, 2009

How do I listen to an event dispatched from non-display-list concrete objects which are created by a singleton factory class?

An example would be where I want to create tweens for objects using a TweenFactoryClass. In my Main.as class I have this:

ActionScript Code:
TweenFactoryClass.instance.tweenMe( myClip, 200, 200 );

then, in my TweenFactoryClass.as, I have:

ActionScript Code:
public function tweenMe( clip:DisplayObject, xLocation, yLocation ):MyTween
{
var tween:MyTween = new MyTween();

[Code].....

I don't know where I should add the listener to be able to hear that event that was dispatched from the MyTween class.

View 9 Replies

Flash :: Flex - Click Event - Objects On Stage To Be Listen To Mouse And Keyboard Input

Oct 19, 2010

If I plan to implement 100 objects on stage to be listen to mouse and keyboard input, is using "function" call responsive enough? How good does eventlistner work?

View 2 Replies

ActionScript 3.0 :: KeyboardEvents Arrows?

Oct 31, 2010

I have them for my arrows to move my MovieClip. It works, but the thing is that my MovieClip is viewed from the side not the top view (and I want to keep it this way). So when I press the left arrow key the movieClip moves but it's facing the same direction all the time. So I tried rotation code but it works for the top view. Then I thought about flipping the miveClip through the y-axis (so that the front will be facing the way it is going), when the left key is pressed.

View 5 Replies

ActionScript 3.0 :: Loading Subclassed Display Objects With Flash.display.Loader?

Oct 8, 2009

When using Loader class to load display objects (bitmaps, SWFs...) from remote URLs, is there any way for them to be instantiated (referenced as we know, by Loader::content property) as some user specified valid subclass? For example if I had a class that extended a Bitmap, is there any way for the loaded object to be of this class?

View 9 Replies

Flash :: Display Objects Which Are Outside The Display Area When Is Embeded In HTML?

Nov 22, 2010

Is there any way to display flash objects which are outside the display area when flash is embeded in HTML
The reason i ask is my current project has a rotating + enlarging effect which is largely dynamic so sometimes an object may clip the edge of the stage areathis looks messy but i dont want to increase the stage area to cover  the largest possible area any object could enter because most of the time the objects are at the center and small so i would end up with a lot of white space

View 8 Replies

Flash - Sorting Display Objects By Their Display List Depth

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

ActionScript 3.0 :: Do Not Resize Display Objects In A Display Object Container

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

ActionScript 3.0 :: Make KeyboardEvents Inside A OnEnterFrame?

Dec 11, 2011

am trying to make a class file Event.Enter_Frame inside a class file function with inside an if statement that would enable key down presses. but i have no idea how i could get it to work cuz i get constnt errors. this is what i tryed

this is a snipet of the code:

package Classes{
import flash.display.Stage;
import flash.display.MovieClip;

[Code].....

View 4 Replies

Flex :: Identify All The Display Objects In The Display List?

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

Flash :: KeyboardEvents Not Firing Until After I've Clicked On An Onscreen Button?

Apr 22, 2011

My document class is Main.as (it extends MovieClip). The following code is in my Main.as.I've declared all these variables in my class definition:

private var holder:MovieClip;
private var leftButton:SimpleButton;
private var rightButton:SimpleButton;

[code]....

View 2 Replies

ActionScript 3.0 :: Listen For The Frame Number And Display Current Frame?

Nov 17, 2009

I have tried this a dozen different ways and I really am at my wits end.

I have a presentation that works like a powerpoint. Everything is working as it should, except one part. I have a movie clip with an instance named slides, and I want to actively display which frame number you are in this move clip.

I have tried more than one why but I see no reason why this should not work:

var frameNum:Number = this.slides.currentFrame;
this.frameText.text = "P�quina " + frameNum + " de 173";

It appears to work at first, but does not update when I navigate the slides. It constantly says 1. Before I just added a function to the back and next buttons to frameNum++ and frameNum--, but after I created the Menu I would prefer it to automatically detect what frame it is on.

View 4 Replies

ActionScript 3.0 :: When Do Display Objects Get A Size

Jul 25, 2011

I am testing parts of an application as actionscript-only and then merge them into a flash project.[code]things align perfectly. When I do the same in flash, s1.height is 0 and objects sit on top of each other?

View 8 Replies

Actionscript 3 :: Removing Display Objects?

Mar 19, 2010

i don't understand why none of my display objects are not being removed. when i press the button, i'm expecting a trace and removal of both shapes and the button, but nothing happens:

[Code]...

i realize there are better ways of accomplishing this, but i'm learning and therefore only interested in why the above code doesn't work.

View 3 Replies

Actionscript 3 :: Display Objects And Level?

Jan 30, 2011

how does the display object level work? is it like in HTML where the latest appended or nested element is the highest?

and how can you give a display object a higher level?

View 2 Replies

ActionScript 3.0 :: Singleton Display Objects?

Oct 2, 2007

I am trying to create a singleton class, that extends Sprite. It seems to work correctly, but it doesn't actually update the screen.If I access my instance and change the properties (x,y,alpha,etc) they will all update, but the display doesn't change.eg:My clip starts at x=0.MyClass.getInstance().x = 99;trace(MyClass.getInstance.x); //traces 99, but it still appears at 0 on the screen.

View 7 Replies

ActionScript 3.0 :: Fit Many Display Objects Of Different Sizes Within A Boundary?

Aug 22, 2009

I am currently working on an AS3 where I need to fit many differently sized display objects within a rectangular boundary without them overlapping. If you take a look at this link, [URL]and take note of how the speech bubbles are able to align themselves in the swf without overlapping, this is pretty much exactly what I hope to achieve.

View 2 Replies

ActionScript 3.0 :: Display Objects And Garbage Collection?

Mar 16, 2009

I'm developing a touchscreen application in AS3, and I havesome problems because the applications reaches 1,5 Gigabyte ofmemory if it's keep running for an hour.this memory size is because I show some videos in streaming,one after another (not in the same), and then they are not garbagecollected: I set the references to the videos to null and I removethe listeners, but flash seems to keep them in memory. I tried todelete the code section about the videos, and I have no problemswith memory (I also load some external images with the videos), soI'm pretty sure they're guilty in some way...I read that there's a bug in flash so displayobjects are notgarbage collected even if you remove the pointers to them: is it

View 1 Replies

ActionScript 3.0 :: Access Display Objects Via Stage Var?

Oct 2, 2008

I'm passing a stage reference to my class, but when I try to access a movieclip on the stage I get an error.[url]...

View 9 Replies

ActionScript 3.0 :: Interaction - EventListener And Display Objects

May 16, 2009

I have two classes ( shown below after problem description), the InteractiveStrategy and Filters classes. The class InteractiveStrategy is the main class definition. In there I declare and instantiate two variables, updateData and filters. I also display the lists mqList and sqList. In the Filters class I have two methods, MainQuestions() and SubQuestions(mq:int). The method MainQuestions() populates a list mqList with the main-questions and SubQuestion populates list sqList with the sub-questions. This means each main-question has a set of sub-questions associated with it.

Thus whenever the main-question (via mqList) changes, the set of sub-questions must change also. My attempt at accomplishing the above is shown in the skeleton code below.The MainQuestions() method dispatches an event called 'mqChanged' while the filter.MainQuestions() listens for the event. However I have no idea of how to execute filter.SubQuestions(mainQuestion) with the newly selected mainQuestion so as to display the new set of sub-questions.

public class InteractiveStrategy{
public var updateData:UpdateData;
public var filter:ArrayFilter;
public var mainQuestion:int=0;
public function InteractiveStrategy(){
[Code] .....

View 4 Replies

ActionScript 3.0 :: Accessing Objects In Display List?

Dec 13, 2009

I have a stage with instances of bauble_mcs on it that are attached by the document class of the main timeline (can someone tell me what the right term is here?  I don't know what I call the main time line in AS3).
 
I then have instances of snow_mc attached by the same class.  Inside the snow_mc I want to test to see if it is hitting any bauble_mcs but I don't know how!

[Code]...

View 8 Replies

Flash - Display Objects Not Aligning Correctly

Jan 6, 2010

I am aligning my display objects in the middle. stage.stageWidth/2. for some reason, they are aligning further off to the right of the screen. I haven't altered anything but the stage width in flash. Has anyone heard of this problem? Again, I haven't done anything except widen the screen and adjust the height.

My focus point on the display object is top left. So it aligns perfectly when set to 0,0
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.stageWidth = 300;

View 2 Replies

Flash - Calling Display Objects To Stage

Apr 15, 2012

I'm new with strings and arrays. I want script to calling display objects to the stage and the timer to move images up and down to appear like a scrolling numbers. I start getting sloppy, and mess up passing to Tweener.

- An explanation or strategy may be enough, "I've got pretty close on this one"
- There was confusion regarding the Containers and addChildren...looked like arrays

The code "get as far as error with NumbersView and numbers undefined etc".

import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.utils.Dictionary;
import flash.events.Event;
import caurina.transitions.Tweener;
[Code] .....

The methods were proved separately. "I got a earlier version of the document going, but I need to work through this to understand it."

Symbol Properties
Class ImageView
Tweener
The "caurina" folder needs to be present
Rolling Numbers "Success loading numbers and connecting to counter".

Placed the movie clip object on stage with two dynamic text fields in it. Make sure the container is placed on stage, has the two text fields in it, and everything is given a proper instance name. Also include the caurina folder.

Seconds MovieClip symbol with instance name of seconds
firstDigit Dynamic text field with instance name of firstDigit, placed in seconds
secondDigit Dynamic text field with instance name of secondDigit, placed in seconds

Symbol
Un-tick 'Export for ActionScript'
Use 'Name, Class, and Instance' correctly

View 1 Replies

Disable / Re-enable Interactivity With All Display Objects

Jun 24, 2010

As an AS3 beginner, I'm trying to translate an old AS2 trick into AS3. I want to disable then re-enable any kind of interactivity with all the display objects on the stage, at once. For example while waiting for external assets to load or after a user clicks on a menu item.

This what I used to do with AS2 :
protect_mc.onRelease = function():Void {};
protect_mc.enabled = false;
protect_mc._alpha = 0;
protect_mc._visible = false;
Then switching protect_mc._visible to true or false.
(protect_mc being an empty movie clip with the stage's height and width, at the highest depth)

My first idea is registering a listener with the Stage for the capture phase of MouseEvent.CLICK that stops all input events propagation (mouse, focus, text...), when a "lock" static variable is set to true or does nothing otherwise. Second idea is using a Custom Event...

View 2 Replies

PHP :: How To Retrieve And Display Array With Objects Using Loop

Jun 30, 2011

In a Flex project, I have an array with objects in it. I want to save this array in a cell on a mysql table along with some other basic info like title, and an id. How to echo all the rows... I'm trying to echo the contents of an array that was serialized and placed in a single cell. This array has objects in it. So, I have this code here to serialize the array, and insert it along with the other info into my DB:

function submitLogDbObj($array,$id,$title) {
$title=mysql_real_escape_string($title);
return mysql_query("INSERT INTO logs (text,id,title) VALUES ('".serialize($array)."','$id','$title')");
}

Then for a test I'm trying to make a loop that will display the log in a way that looks like a conversation... An object in my array would look something like:
[1]
icon = ""
msg = "this is a test"
name = "Them: "
systemMsg = 0
[Code] .....

View 3 Replies

Actionscript 3 :: Dealing With Display Objects On The Stage?

Oct 3, 2011

I think there are 2 different practices with dealing with display object on the stage.You draw all the objects on the stage and then manipulate the "visible" attribute to show or hide them.You use addChild and removeChild to manipulate the visiblity.How do you think what is the best method for this?

View 3 Replies

ActionScript 2.0 :: Display Array Objects At Given Interval?

Sep 25, 2009

I'm creating an array from an XML file, attaching a movie clip to another movie clip for each object in the array, then creating a dynamic text field and inserting text from the XML file within each new movie clip, then applying a tween to each array object.

ActionScript Code:
var sectionData_arr:Array = new Array();
function buildSectionMenu(){
sectionData_arr = XPathAPI.selectNodeList(_root.configXML.firstChild,"/config/content/section");

[Code].....

The problem is that since the AS in on the first frame, the script is run and then everything is dumped out onto the first frame. How do I display the tween for each object in the array sequentially? Should I use setInterval? Or should I attach each object to a specific frame?

View 0 Replies

ActionScript 3.0 :: Removing Display Objects Using Timer?

Jan 1, 2010

I have an animation of footprints being left on the ground as if by an invisible man or ghost. the animation consists of:

1 movieclip containing --> 5 footprints each one is an individual movieclip. Each print fades in and out using the Tween class with an alpha effect

The main timeline uses the following code to create random instances of the animation:

var myTimer:Timer = new Timer(12000);
myTimer.addEventListener("timer", timedFunction);
myTimer.start();

[Code].....

so it looks like the function is being called correctly and removing the first instance of FOOT from the stage. but the 2nd iteration generates the error. Is this is a problem with the timer? I would like to send this to someone for examination and assistance.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved