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


Similar Posts:


ActionScript 2.0 :: Dynamic Interaction With Objects?

Jan 22, 2006

I am making a chainsaw massacre game, you can find the beginning of it here; http:[url]... I want to be able to jump up and kill the guys in the head, and also the stomach etc etc, but I don't really know how to make it this dynamic, should I have a MovieClip for each body part, or how should I do it?

View 1 Replies

ActionScript 3.0 :: Applying EventListener To All Objects Of MovieClip

Nov 5, 2010

How do I apply EventListener function to all objects of a MovieClip from the main Timeline?I have ball_1, ball_2.. ball_10 objects of movieClip Ball of class Ball. Is there any way I can add EventListener to all of them in a single line? Will there be a increase in performance?I have tried EventListener from inside the MovieClip , but for my purpose I need to use it from Main timeLine? or is it possible with Classes?

View 5 Replies

ActionScript 3.0 :: Change Dynamic Text Display Using Eventlistener?

Apr 25, 2009

Before someone tells me that I should have searched the forum before posting an easy question like this one probably is that has already been posted and responded to a hundred times, I did try to search but I kept getting an error page saying something is wrong with the site. So anyways, what I am trying to do is have a text box display the number 100. Then there are two buttons. When one is hit, the number bisects between itself and last number lower than it displayed, when the other is hit it bisects between itself and the last number larger than it displayed. For instance, hitting the first button will change the value to 50 then when hit again to 25. If you then hit the second button it goes to 37.5 and then hit that button again it goes to 43.75. I have the following code:

var ce:Number=100;
ce0_txt.text=String(ce);
ce0left_btn.addEventListener(MouseEvent.CLICK, bisectdown);

[code]......

View 6 Replies

ActionScript 3.0 :: Possible To Make Instances / Children Interact With Other Objects By Adding EventListener

Dec 31, 2011

I know it is possible to make instances/children interact with other objects by adding an eventListener to each child/instance.But how do you make a random instance/child interact with another random instance/child?Example: let a bunch of spaceships get damaged by a bulletrain by using addChild to place both spaceships and bullets on the stage.

View 2 Replies

ActionScript 3.0 :: EventListener Function Specific To Generated Display Object Container?

Nov 16, 2008

This has to be simple, if only I knew how. I'm an AS3 newbie, and am having difficulty setting up multiple specific EventListeners within a code generated display object container.

I am generating a 'page' (Sprite) with a heap of 'cards' (Sprites) on it. Each of those cards, in turn, contains a selection of text boxes and other objects generated from database output using a 'for' loop. My hope is to attach an EventListener to each 'card' so that a MouseEvent will let me manipulate the data that lead to the content of that actual card (the i-th iteration of my for loop). I've been playing with everything I can think of (limited repertoire of thoughts though) and the best I've managed is for my EventListener to access the final set of data, whichever 'card' I click on. I've summarised and attached my code for the function, how to get back to the i-set of data from the EventListener attached to the i-th card. I can handle the PHP and MySQL side of things but am fumbling my way into the OOP of AS3.

View 6 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

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

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 :: 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

ActionScript 3.0 :: Use HitTestObject With Nested Display Objects?

Sep 14, 2010

I'm having trouble using hitTestObject with Sprites which happen to be nested in other Sprites. The collision test is off by exactly the difference between the local coordinates and global coordinates of the nested Sprite. To try and make my question clear, here's a simple code example of what I'm trying to do: I have a Vector containing Sprites called myVector

[Code]...

View 0 Replies

ActionScript 3.0 :: Use Arrays To Display Objects On The Stage?

Apr 4, 2011

How can I use arrays and some how display my objects accordingly based on my code below?

What I have here are three buttons that when clicked a new clip is added to the stage with a predefined position which means that when button1 is clicked the MovieClip will be added at the very top and when button2 is clicked the MovieClip will be added at second and when button3 is clicked the clip will be added at the very bottom, but what I would like to do is to be able to dynamically position these objects based on how many clips exist, in other words if button3 is clicked first, I want the clip to be positioned at the very top and if later button1 is clicked the clip is positioned

Accordantly (at second place). I know this may be simple, in fact I could probably use a few IF statements but I know the code would look ugly (yes, even more) and I may have add more buttons later. What I would be awesome is to some-how use arrays or something that makes more sense to hold the MovieClips and then display them accordingly.

ActionScript Code:
button1.addEventListener(MouseEvent.CLICK, addItem1, false,0,true);
button2.addEventListener(MouseEvent.CLICK, addItem2, false,0,true);
button3.addEventListener(MouseEvent.CLICK, addItem3, false,0,true);

[Code].....

View 3 Replies

ActionScript 3.0 :: Stage Align For Display Objects?

Oct 22, 2007

I've been putting off asking this question and have tried to resolve it myself since it would seem to be so basic; however after much frustration , here goes:Can a display object (ie an instance of a class loaded from the library such as a filled rectangle {trying to keep this simple} be positioned on the main stage by using the following syntax:myrecTangle.stage.align = StageAlign.BOTTOM;I have created a fairly simple class to load objects to the stage by class type (recTangle) and name (myrecTangle) and all works fine up to the positioning. The objects are created and named properly and are placed on stage; however, they are all placed on stage at 0,0 stage coordinates. I can postion them anywhere using x. and .y values but when I use syntax similar to that above they are still positioned at 0,0. There are no errors thrown. I have also tried to create a sprite for each, load them into the sprite and addChild the sprite to the stage. They are still positioned on stage at 0,0. Is the stage.align/StageAlign syntax peculiar to absolute main stage positioning or am I allowed to use it also for object positioning.

View 1 Replies

ActionScript 3.0 :: Garbage Collection For Display Objects?

Feb 27, 2009

I've been in a trouble with "removeChild" for a while. I know there must be some great discussion around but just could not find some nice posts in details.

View 2 Replies







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