Actionscript 3 :: Send Events Between Objects On Same Level (Global Event Manager)?

Sep 8, 2011

I came to the point where I need to communicate between 2 objects (let's say Tank and the Cannon). It is tile game, and when the Tank approach specific tile I need my Cannon to shot the Tank. When Tank gets that specific tile I want to dispatch some custom event and have listener in Cannon class body to make the shot happen. Other way I would have to check in ENTER_FRAME loop (inside Cannon body class) if the Tank touched tile that runs the Cannon shooting - but this is not elegant and efficient. The issue is complicated by the fact that the Cannon and Tank are added to the Engine (document class) and can't simply hear for each other, because they seat on the same level in display list.

Initially I could addEventListener to the Engine, but this way my document class would enlarge to the XXL size (all listeners functionality, all methods for game etc). What I would accomplish is to have event listener in every Cannon object (defined in body class) listening for Tank's dispatching the event. I saw some 'Centralized Event Manager' article in the net, but can't download full classes [url]...

View 1 Replies


Similar Posts:


Global Security Manager In Flex?

May 31, 2010

I made a swf that interacts with other site on the internet (which has a crossdomainfile for me).in the main.mxml there is a definition of webservice (mx:WebService)(which is not in my domain). Therefore when loading the swf, there is a first call to crossdomainfile.xml.I put this swf on my server so that my clients can get it.

When i connect to my server to download the swf, i expect to be asked if i want to allow the swf connect to foreign webservice domain.Do i always need to define exception in Global Security Settings panel?I don't want my client do define special things..Is there a best practice for that? Why when i surfing the net other swf can do this? I read about the FlashPlayerTrust, can i define there a website i trust my swf will connect to?

View 3 Replies

Flash Won't Save Cookies + Global Settings Manager Broken

Aug 30, 2009

I've had a problem which has been persisting for a long time now - Flash won't save any cookies to my computer. Originally I thought that it was my security settings, and indeed when I went to the global settings manager I clicked the "unlimited" option for data saves and allowed this for all sites. But when I reloaded the page the changes hadn't been saved. No matter how many times I clicked on the options to allow cookies and give unlimited data storage, whenever I came back the settings had reverted to default, as I had found them originally.

And when I went to C:/Documents and Settings/[user name]/Application Data/Macromedia/Flash Player#SharedObjects/ I found that there were no folders there, for none of the sites that I had visited.

This problem persists on IE, Firefox and Google Chrome. I've shut off all adblockers, all firewalls, all anti-virus software, uninstalled and re-installed Flash twice and still nothing. I'm at my wits end. I'm running Windows on a PC.

View 1 Replies

Flex :: Listen For Events On The Pop Up Manager Class?

Jan 27, 2012

I'm trying to detect when pop ups are visible (including tool tips if possible). The reason is that I need to hide or freeze (capture a snapshot) the Stage* components (StageWebView, StageVideo, StageText etc) when pop ups appear.

View 1 Replies

ActionScript 2.0 :: Access A Global Variable From An Swf On A Different Level Than Another (outside Of Movies)?

Apr 18, 2004

Is it possible to access a global variable from an swf on a different level than another (outside of movies)? Or are they only global in the sense that they can be accessed from different scenes in the same movie? I want to check whether or not a certain movie (called by loadMovie) is on a certain frame (if else statement), and then act accordingly (tell it to play a certain frame in that movie [shut itself down, figuratively], or nothing).

View 5 Replies

Actionscript 3 :: Transition Manager Event Complete?

Mar 24, 2010

I have the following code

TransitionManager.start(babyPreloader,{type:Fade, direction:Transition.OUT, duration:0.5, easing:Regular.easeOut});
var tempPreloader:DisplayObject = babyPreloader as DisplayObject;
this.removeChild(tempPreloader);

But since this does not wait for the transition to complete. I cannot see the transition happening. Is there a way to have a even listener for transition complete?

View 1 Replies

ActionScript 3.0 :: How To Create Package Level Global Variables And Constants

Dec 1, 2009

I'm having a little issue understanding scoping in this package environment. My question is this: Is it possible to declare globally visible variables and constants? I tried this with no successful results:

PHP Code:
package {
import flash.display.Loader;
import flash.display.Sprite;
import flash.net.URLRequest;
import games.mineAllMine.MineAllMine;
[Code] .....

View 6 Replies

ActionScript 2.0 :: Flash 8 - Variable Global Level And Multiple MovieClips

Oct 31, 2007

I am writing a simple game in which the hero will need to jump on a trampoline. The thing is there are various trampolines (set as instance name tramp1, tramp2, tramp3 etc, and only one trampoline will be active at any given time. I have set a variable _global.level which decides which trampoline is active but how do I do the hit test?

So far I have:
trampland = _parent.ground.tramp2.spring.hitTest(this._x+8, this._y+32, true);
if (trampland) {go and do something}
But how do i tell which 'tramp' to use? I have been trying
_parent.ground.tramp[_global.level].spring,
But to no avail.

View 2 Replies

ActionScript 3.0 :: Catch Transition Manager Finished Event?

Dec 31, 2009

I am doing a small transiction using TransitionManager.start() function. how can i call a method after finishing the animation? i mean how to add event handler for this?

View 0 Replies

Flex :: Drag Manager - Access The Target Of Dragging Event In DragDropHandler?

Mar 29, 2011

I'm making a Matching Game where I have some images on my left and I can drag them onto images on my right and if they are matching, they should both disappear from the stage.

[Code]....

findMatch() is a function that finds in my XML file the path of the file that matches the file that is being dragged. Having that path, I send it to dragEnterHandler where it compares it with the path of the dropTarget file and if they are the same, it accepts it. Then in dragDropHandler, I'm changing the source path of my second image to "", so that it disappears from the stage. How can I access the first file (the one that was being dragged), so that I can change its path to "", to get rid of it?

View 1 Replies

ActionScript 3.0 :: Global Variable Event - Create An Event Detected To See If It Reaches A Certain Number?

Oct 26, 2010

If I have a Global Variable Globalvars.vars.noLoaded which is in many classes How do I create an event where i detect to see if it reaches a certain number.
 
[code]...

View 3 Replies

ActionScript 2.0 :: Send This Global Variable To PHP Script?

Feb 24, 2006

I have an email form that I'm sending to a PHP script. It's basically two variables, one for the senders email, and one for the message. They are both within a movieclip called 'form', and they are working with this code...

on (release) {
// send variables in form movieclip (the textfields)
// to email PHP page which will send the mail
_level2.form.loadVariables("email.php", "POST");

[code].....

I use level2 because this whole email form is being loaded onto level2 of my flash site.What I'm trying to do is to send the _global.var_name to the PHP as well. It represents a makeshift radio button selection....and when I trace it, it works.But either it's not sending over there, or I'm doing something wrong with the syntax, or I'm not receiving it properly.On the PHP side....I'm using...

$message = $_POST["message"];
$message .= "
" . $_POST["_global.var_name"];

And it isn't working.

View 1 Replies

ActionScript 3.0 :: Global Events Versus Registering Components?

Jun 22, 2009

I'm building an object oriented project with liquid layout in a loose MVC framework. My controller knows when the stage is resized, and it needs a way to tell all of the display objects to rearrange themselves appropriately when the stage resizes.

Option 1 would be extending the sprite class with a class that has one additional resize() function. On initializing the class it would register itself with the controller which would then noitfy all of the assets when it detects a stage resize.

Option 2 would be building some sort of global event that any child of the stage could listen for and do its thing when the event comes through.

View 3 Replies

Flash At Lower Z Level Masks Mouse Events?

Sep 14, 2009

I have a web site with an intro movie playing in the page's header.

The SWF playing the FLV with sound is in a division that is placed at a lower Z level. On top of the SWF, at a higher Z level, is a png image of my header containing an oval transparent window. This image acts as a skin sitting on top of my movie. The movie and sound play inside the oval window fine. I have other reasons for this approach as opposed to integrating the whole header image into the SWF.

The issue is I have no mouse control over the SWF because it is at a lower Z level. The mouse events are blocked by the transparent image window that sits on top.

I want to add a sound volume control to my movie. The control can sit either inside the oval area, or outside somewhere else on the page.

I would prefer to control the volume using another SWF that sits at the normal Z level where the mouse can work. Can one SWF control another?

Other alternatives might be to use Javascript, or even HTML image tags to control my SWF.

View 2 Replies

ActionScript 2.0 :: Key Handler Can't See Global Objects

Mar 9, 2010

I'm making mobile aplication in Flash Lite 3.0. I've wanted to add key event handling, when some problem occured. Below is my class, which controls main menu with three buttons. Function onKey() is an event handler, but unfortunently it does not detect any global objects (e.g. currentButton or Butons). Only trace() and local code are working.[code]...

View 1 Replies

ActionScript 2.0 :: Key Handler Does Not See Global Objects

Mar 9, 2010

I'm making mobile aplication in Flash Lite 3.0. I've wanted to add key event handling, when some problem occured. Below is my class, which controls main menu with three buttons. Function onKey() is an event handler, but unfortunently it does not detect any global objects (e.g. currentButton or Butons). Only trace() and local code are working. How can I deal with it?

Code:
class MainMenuInit
{
var i:Number;
var Buttons:Array;
var currentButton:Number;

[code]....

View 1 Replies

ActionScript 2.0 :: FL8: Calendar Development - Call A Flash Movie Onto A Higher Level Which Contains The Events Of The Day Click On

Apr 13, 2006

i am puttin together a calendar in flash, as it is ending up on a windows server in ASP, so the lovely PHP calendars wont work. I have been using the code from:[url]to get the months and days working, and have todays date highlighted. Now i need to work out a way that i can set this up to call a flash movie onto a higher level which contains the events of the day you click on. Such as: Because the dates are determined and inserted via AS, im not sure how to set this up, or if it is even possible...

[Code]...

View 3 Replies

ActionScript 3.0 :: TypeError: Error #1034: Type Coercion Failed: Cannot Convert Flash.events::Event@3738fb79 To Flash.events.MouseEvent

Mar 27, 2012

iam making a game and i almost finish except one error i couln.t get it

TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::Event@3738fb79 to flash.events.MouseEvent.
TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::Event@3738fb79 to flash.events.MouseEvent.

[code]....

View 4 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 2.0 :: Place Inferior-level Objects On Top?

Jan 21, 2005

Ive got one index-file on _level0, from which I load another file into _level1, on top of _level0 covering it completely.

I would like a single (not all) object on _level0 to show on top. Is that possible?

Layers would only work, if Im not misstaken, on a single level, so I guess thats out.

View 4 Replies

ActionScript 2.0 :: Place Inferior-level Objects On Top

Jan 21, 2005

Ive got one index-file on _level0, from which I load another file into _level1, on top of _level0 covering it completely. I would like a single (not all) object on _level0 to show on top. Is that possible? Layers would only work, if Im not misstaken, on a single level, so I guess thats out.

View 4 Replies

ActionScript 3.0 :: DispatchEvent To Send Keyboard Events?

Mar 19, 2010

I am trying to create an on-screen keyboard for a touch-screen kiosk. Does anyone know how to send a keyboard event to a text input component from a button click event? For example, the user will push the on-screen buttons to enter their name, press tab to go to the next field, and so on.
 
I believe that I somehow need to use dispatchEvent but have not been able to get it to work. For example, pressing the on-screen A keyboard button will fire a CLICK event and call a handler to place an A in the currently focused text input component. The handler needs to be able to dispatch a keyboard event (with the correct keycode) to that text input field and that is where I am stuck.

View 6 Replies

ActionScript 3.0 :: Referencing Objects In The Level Above The Movie Clip?

Sep 10, 2011

i want to referance objects in the level above the movie clip that i have the AS in.  what i mean is that i have a movie clip on the stage, and that movie clip has some actionscript in it, and that AS needs to refer to an object on the main stage, how would i do that?  i have tried parent and stage 1, but neither seem to work

View 4 Replies

ActionScript 2.0 :: Timeline Events - Add Listeners And Send Out Dispatchers?

Apr 30, 2009

In my SWF, I have a movie clip that I wish to play itself immediately after the site loads. I have two other movie clips that are required to play once the first movie clip has reached frame 13. This is a function that I would like to repeat, as the first movie clip (followed by the other two) will be required to play the others after certain mouse events within the movie.

PHP Code:
hello_button.addEventListener(MouseEvent.CLICK, click_handler);
function click_handler(event_object:MouseEvent) {
/* Do something with this event */
}

While others import class objects and operate under package headings when describing how to add listeners and send out dispatchers.

View 2 Replies

Send Keyboard And Mouse Events To Flash Movie?

Feb 22, 2010

I'm looking for a way to "inject" some events into a flash movie running on a browser. I know about ActionScript's ExternalInterface.addCallback function, however I'm trying to achieve this with any "random" flash from the web. Eg. send a "SPACE" keyboard event to a youtube video.

View 4 Replies

ActionScript 2.0 :: Send Mouse Events To Loaded Movie?

Feb 23, 2009

I'm loading a SWF from my main stage using loadmovie() to a specific holder movieclip.Now i want to send that MC simulated mouse events (like click for instance).I`ve read about it and tried using dispatchEvent but no success so far.

View 0 Replies

ActionScript 2.0 :: Activating The HitTest - Passing The Objects Name As A Parameter Through A Global Function

Jun 16, 2004

I'm having troubles activating the HitTest, passing the objects name as a parameter through a global function. Let's say there is the following function on the main timeline:

[Code]...

View 3 Replies

ActionScript 3.0 :: Top Level - Loading Objects In A Paper-vision Gallery Through Xml?

Nov 2, 2009

I am loading objects in a paper-vision gallery through xml. I have a footer with some links in them, but the problem is the XML stuff is being loaded on top, how do I get the links and such to be on top so they are not underneath?

View 4 Replies

ActionScript 3.0 :: Dispatch And Listen For A Global Event?

Feb 24, 2011

I know there's been quite a few posts about events, but I've run into a problem that I haven't really encountered before, and I've kind of confused myself with all the talk of "bubbles" and "capture" and various complexities of creating custom events, etc...Anyway, I'm trying to figure out how to dispatch a global broadcast style of event.1) If I have a custom class that resides in the Display List (the DispatcherClass), how do I set up this class to broadcast a "global" event?Actionscript Code:1b) If I have another custom class that also resides in the Display List (but in a completely unrelated heirarchy), how do I get this ListenerClass to "hear" the event WITHOUT explicitly referencing the instance of the DispatcherClass like so:

Actionscript Code:DispatcherClassInstance.addEventListener("DispatcherClassEvent", handler, false, 0, true);Is this even possible?2) What if the DispatcherClass DOES NOT reside in the DisplayList?Is it possible to dispatch a "global" style event since there is nothing to "bubble" up through?2b) How would I get a ListenerClass, maybe on the DisplayList, maybe not, to "hear" this event?

View 11 Replies

Actionscript 3 :: Attach A Global Event Listener?

Feb 17, 2012

I am working on an AIR application:

The main window is like a dashboard. With the menu bar, I can open other windows with dashboard details. When I close these, I'd like to refresh the main window.

I tried to use an event listener, but the result is not good. If I open detail windows directly from the main window, I know how to add an event listener - and it works - but I don't know how to do it, if the detail window is opening from the menubar!

View 3 Replies







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