ActionScript 3.0 :: Sending An Event To The Stage From A Non-displaylist Object?

Oct 11, 2011

I've found myself in a tricky place, I've built an app that loads in swfs as external libraries so they can easily be changed at run time, all works well. I now need to separate the code from the art in these libraries so that external developers can change the art without getting their mitts on the code. Trouble is to do this my new code only library elements will need access to my overall manager class, which is the main document class, so that they can access the library manager class to add the appropriate art assets to themselves.

Now there's a couple of clumsy solutions I've thought of:

1, Store a manager class reference in a static var but that seems like a cop out.

2, Go through a few hundred thousand lines of code and alter every instantiation of a library element to include a manager reference - erm, let's not go there.

3, Have the library element send a custom event to the stage from its constructor which passes a return handler to the event listener so that can pass back a manager reference. Sounded like genius initially up until I realised that at constructor stage the library element won't be on the display list so can't bubble up to the stage

View 4 Replies


Similar Posts:


Actionscript 3 :: TextLineMetrics Get Text Width BEFORE Object Is On Displaylist

Jan 24, 2012

I have a library MovieClip Class that consists solely of a dynamic textfield contained in a MovieClip. I want to instantiate this MC, populate the textField with text, get the width of the resulting text and, if the width is less than a predefined MIN_WIDTH value, append more text. When the width is equal to or greater than my MIN_WIDTH value, add this MovieClip class to the display list. My question is, does anyone know if its possible to retrieve the length of text in a textField using Textlinemetrics BEFORE the textField has been added to the display list?

View 2 Replies

ActionScript 3.0 :: Referencing A TextField Inside Object On DisplayList

Nov 20, 2009

I have a bunch of objects with TextFields in them that are added to another object called Field.[code]If it is a player, and I can scale it, why can't I access the textField?

View 1 Replies

ActionScript 3.0 :: Remove Displaylist Object Created In Different Class?

Apr 15, 2009

i have two classes:

videoPlayer(Document class) and videoControls(which is added to the stage by videoPlayer).

videoControls put an object on the stage at some point:

dp = new displayEnd();
dp.name="dpe";
addChild(dp);[code].....

View 1 Replies

Actionscript 3 :: Using Event Handlers To Remove MovieClip Object From Stage?

Jul 7, 2011

In the code below, I have created an instance of the DrawLineChart class called LineChart1.When I test the movie, it shows up on the stage just fine and when I click on it, I can use a trace command to get a string statement written to the output window. However, now I want to be able to click on LineChart1 on the stage and have it be removed. When I do that, I get an error message 1120: Access of undefined property LineChart1.

why I'm unable to refer to my instance LineChart1 and what I need to do so that I can refer to it and remove it when it gets clicked? why the trace statement works when I click on LineChart1 during runtime, but not the removechild command.

package{
import flash.display.*;
import flash.events.*;[code]....

trace("hello"); // This works. When I click on the LineChart1 MovieClip on the stage during runtime, I get "hello" as an output. removeChild(LineChart1); // throws an error 1120: Access of undefined property LineChart1.

View 2 Replies

ActionScript 3.0 :: Static Function That Remove The Object From The Stage As Well As Removing Its Event Listeners?

Oct 12, 2011

I want to make a static function that I can use in all the custom classes.It should be some kill(); function that would remove the object from the stage as well as removing its event listeners. I made it in Document class, and it didn't work. Here's the code:

ActionScript Code:
public static function kill(e:DisplayObject)
{[code].....

View 3 Replies

ActionScript 3.0 :: Dispatching New Event Upon Sending Request To HTTPService

Jul 9, 2009

I've a Services class...which handles the HTTPService requests and responses and faults. Now I want to dispatch a new event whenever I send request to the server...so that I can take custom actions like showing some popup window or disabling certain components.

Here is my services class:
PHP Code:
package business{
import mx.controls.Alert;
import mx.managers.CursorManager;
import mx.rpc.AsyncToken;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.http.HTTPService;
[Code] .....

The method doRequest calls the HTTPServices send method...so in this method, I want to dispatch a new event and handle it in the main application...

View 1 Replies

ActionScript 3.0 :: Sending One Part Of The Stage

May 23, 2010

I have found an example which should show things better.  It is here [URL]
 
Basically, on that stage, they have several movie clip objects..One for the actual card, one to hold the components, one to perform actions etc.  When you drag and drop items to create your card, you can then send it via email.  However, what is sent is only the card part of the whole stage, not the parts which hold the components and actions.  So, they basically send one movie clip component of the whole stage, rather than everything which is on the stage.

View 7 Replies

ActionScript 3.0 :: Sending To Text Box On Stage?

Oct 21, 2009

I have a few functions inside one of my objects (in this case, a box with code within it to let it become draggable.) However, I have this inside the box code:

Code:
function onComplete (event:Event):void {
var resultVar:URLVariables = new URLVariables( event.target.data );
if(resultVar.resultCheck == 1) {
saveresult_txt.text = "Save complete!";

[Code]...

This is because saveresult_txt.text is actually on the stage and not within the box element itself. How would I go about sending the text directly to the box on the stage?.

View 7 Replies

ActionScript 3.0 :: Sending Looped Event.CurrentTarget To Start Position?

Nov 23, 2010

I've got a problem with an if/else statement within a function which checks to see which 'drop area' one of ten items should to snap to.. the problem is I can only set the start location of each item to work on the first hitTest, otherwise after clicking another item or positioning any item in one of the drop areas, the drop area becomes it's start location due to startDrag() and stopDrag() been called again to move the object..

What I've tried to do here is to create a variable (which does trace the correct (currentTargetHome) movieclip reference, but as a string) but it doesn't work when I try to access it's attributes using [currentTargetHome]. The item exists within the movieclip "gamePage" and the rest of the function works !

[Code].....

View 9 Replies

Sending Image (Screenshot Of Stage) By Email

Sep 5, 2009

I would like to take a "screenshot" of the stage within flash and send it as an image by email. I have tried AMFPHP and the method described here - [URL]. This is saving a jpg of a movie on the server, but no email function. I know how to setup a very simple php email file but without attachment. So my problem is I have no idea how to "connect" all those parts together and make it so that when you click the button in flash it'll send the jpg by email directly.

View 2 Replies

ActionScript 3.0 :: GotoAndStop() / Stop() Fail - Sending An Event From One Of The Frames Of A Movieclip

Dec 3, 2009

I've recently had a problem in my application's flow. I was sending an event from one of the frames of a movieclip and the issue was that it was being sent over and over and over when I wanted it to be sent only once. I assumed that placing a call to stop(); at the last frame of the clip would prevent it from looping. This was not the case however. After that I tried calling gotoAndStop(0); to reset the movieclip and stop it from looping. This did not work either. Then I went through my code to make sure nothing else was causing it to play.

I solved the problem by adding an extra frame to the end of the clip and calling gotoAndStop to that frame instead of 0. I've looked around the forums and google for information on this phenomenon but have only found cryptic answers. I was wondering if someone could explain the divine purpose that drives MovieClips to play regardless of whether they are told to stop or not when they get to frame 0 or 1.

View 2 Replies

ActionScript 3.0 :: Sending Copy Of MovieClip To Custom Stage

Feb 4, 2012

I have a custom menu with moviclip inside, I want to click in movieclip, and send to my custom stage a copy of movieclip: [URL]

ActionScript Code:
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.utils.ByteArray;
import flash.text.engine.EastAsianJustifier;
[Code] .....

But I have this error:
TypeError: Error #1007: Tentativa de instanciao em um no-construtor.
at testeMenu_fla::MainTimeline/teste()
Here my .fla: [URL] My question is: how to convert a e:Event in MovieClip?

View 9 Replies

ActionScript 2.0 :: Sending The Object Properties?

Feb 23, 2009

I'm working on a project that has to pass variables to (and later read them from) a URL encoded text file.

Code:
getURL("process.cgi", "", "POST");

This has worked until now, dumping all of _level0's variables into the document, retrieving the relevant ones on load.I've recently made some modifications so that I'm no longer storing all the variables in _level0, but some of them as custom properties of objects, e.g.:

Code:
t1c1r1.customproperty = 6;
t1c2r1.customproperty = 5;

In these cases, the properties are not being passed to the process.cgi, and not getting recorded in the text file.

I suppose I could flatten the variables out, record them on _level0,

Code:
t1c1r1_customproperty = 6;

but I'm wondering if there's a way to send these variables as is.

View 3 Replies

Flex :: Can't Add Application To Displaylist?

May 26, 2011

I'm trying to use a SWFLoader to load an Application and add the loaded Application to my Displaylist.

public function onComplete(e:Event):void {
someContainer.addChild((e.target.content));
}

[code]......

View 3 Replies

ActionScript 3.0 :: Object Sending Its Name To A Global Function

Jun 22, 2009

I'm trying to send an object's name to a global actionscript function. It works with a listener in the action layer:

_root.ButtonName.onRelease = function() {
trace(this._name);
}

But there will be hundreds of these objects, so I'd like to have each one call a global function, so I tried code for each button like this:

on (release) {
GlobalFunctionName(this._name);
}

But for some reason, the value being passed is null. (Although if I switch "this._name" for a string, that works correctly.) Question: How can a drone object pass its name to a central function? Should I be using "on (release)" or should I use a listener within each object instead? Also, is it best to make them Buttons or Graphics or Movie Clips since there will be so many of them?

View 3 Replies

ActionScript 3.0 :: Take For A Sprite To Be Added To The Displaylist?

May 28, 2009

I am having some trouble understanding the display list.  This might sound silly but how long does it take until a sprite is added to the display list?
 
My understanding is that the root variable is only accessible once the object is added to the display list.In the following code I add the TLSEntry_Text to the display list and then on the next line I try to trace its root variable without luck.  The root variable appears only in the enter frame event...  I guess a little bit later.
 
What am I missing here?  Is there a way for the display list to "force refresh" itself?

[Code]...

View 5 Replies

ActionScript 3.0 :: Detecting DisplayList Order Changes?

Feb 7, 2011

Is there any event dispatched in ANY place of the display list if the order of display list items change?Or is there any other way to track that without manually keeping track of all display list order or needing to override all "setChildIndex" and "swapChildren" functions?

View 2 Replies

ActionScript 3.0 :: Sending Associative Arrays To Javascript (in An Object)

Feb 16, 2010

I'm trying to send an object to javascript that can have an arbitrary number of elements included, including associative arrays. If I create the following object:[code]The numeric indexes of the array will trace out, while the string based indexes will not. Does anyone have any idea why this might not be working? (Running CS4, I can't find the option to change my signature)

View 3 Replies

Actionscript 3 :: Sending Textarea Text To Datagrid As Object?

Jun 16, 2011

I would like a text area that holds multiple strings to send its values to an array and the array to convert the string to an object. The objects then populate a datagrid. I can't really figure out where to go from here:

[code]...

View 1 Replies

Actionscript 3 :: Remove Array-objects From DisplayList?

Jan 4, 2011

I'm working on a game for the iPhone using flash, and since memory is crucial i want to clean up displayObjects not needed. All the objects i need to delete is MovieClips taken from some array to another using splice(). Here is the [code]...

View 2 Replies

Actionscript 3 :: Monitor Change Of A Component's Displaylist?

Mar 25, 2011

I'm working on a drag-drop solution, and acting when a item is dropped on the current target (let's say an "intelligent chess-board") is a breeze, as the board fires DragEvents when items are hovering over on dropped on the it.

What I'm looking for is a way to make the board act when an item is dragged OFF the itself. Of course - when the item is dropped somewhere else, I could fire an event there and tell the board that change has been done. But this is what I want to avoid.

I wonder if there is some way to monitor a change in the displaylist of the "board", so it fires an event when a child/element is removed from "outside"?

View 1 Replies

ActionScript 3.0 :: Loop AddChild Then Target To Add To Top Of DisplayList?

Jul 18, 2009

I am just trying to grasp a simple concept of utilizing loops, addChild, and eventListeners.My goal is to use a loop to create multiple instances of the same type of object from my library (called Ball), and when one is clicked, have it move "above" all other instances on the stage (and eventually drag, but that's easy enough to make happen later).My current code attempt is:

for(var i:uint = 0; i<=10;i++)
{
var my_ball:Ball = new Ball() //new instances of Ball from library export

[code].....

View 2 Replies

Flex :: Sending A Json Object Over Flash Builder 4 Webservices?

Aug 12, 2010

Can I use the webservice wizards in Flash Builder 4 to send a json encoded object...not as a string but as type application/json; charset=UTF-8

View 1 Replies

Actionscript 3 :: Trigger Custom JQuery Event From Flash Passing Some Data Through Event Object?

Dec 2, 2010

How to trigger a custom jQuery event from Flash, passing some data through event object?

View 2 Replies

Flex :: ComboBox Dropdown Scaling Does Not Follow DisplayList?

Jan 13, 2010

I've been working on an application (with ComboBoxes) that requires scaling the entire application based on screen resolution. I thought it would simply require changing the "scaleX" and "scaleY" properties of the top-level application, but discovered that the ComboBox dropdown doesn't appear to scale accordingly, as in the following example:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
applicationComplete="init()">

[Code]....

which results in the dropdown appearing (sliding down) unscaled until it reaches it's extended length and stops at which point it scales up and remains at that scale until it is closed. I have also found that if you call "invalidateDisplayList()" on the comboBox or the dropdown, then it undoes the scaling, so it appears that whenever the updateDisplayList is called, the dropdown only applies it's parent ComboBox's scaling, and not the ComboBox's parent container's scaling.

I understand that, as a pop-up, the dropdown isn't in the Application's or ComboBox's displayList tree, which appears to be the root of the problem (no pun intended).

View 3 Replies

ActionScript 3.0 :: Using The Time Line And The DisplayList - DL Keeps Duplicating Stuff

May 7, 2010

Iv'e been slowly moving over to AS3 in the past few months and I think I have learnt quite a considerable amout. However I am completly dumbstruck by the behaviour of the DisplayList. The kind of work I do requuires that the flash movies I make are timeline based (I know spitting in the face of OOP) because of the amount of animation used. However within these animations I also use snippets of ActionScript to have interactive moments such as drag and drops or tabs for the user to select a section. Now in these cases I as you would expect have to redepth some stuff (like the currently active panel of some tabs or currently active drag item etc). Using the display list I think is dead easy and I actually prefer it to the old Depth based system of ActionScript 2. This is where the odd problem starts.

On my stage I have 2 insences of the same MovieClip ("Clock1" and "Clock2") which has a child named "hand", also I have 2 text boxes just to dictate which movie is which. These clips and text are nothing special just author created in flash so no code involved for adding them to the display list.

[Code]...

View 2 Replies

ActionScript 3.0 :: Distinguishing Between Externally Loaded MovieClips And SWFs In The DisplayList

Oct 28, 2008

I am trying to create a graphical representation of the DisplayList of a flash site that is loading many external swfs. I want to be able to filter what is displayed (ie. Show only textfields, or show only images, or show only whatever). I have not been able to find a way to distinguish or select only the swfs. I would like this to be able to list ALL the swfs that are used in this projects and nothing else..

View 2 Replies

ActionScript 3.0 :: [object Class] Instead Of [object MovieClip] - Delete The Targets ENTER_FRAME Event?

Mar 15, 2009

When I use MouseEvent.MOUSE_OUT the target is [object MovieClip], but when I use MouseEvent.ROLL_OUT I get [object Bildspel] - and Bildspel is my class. The thing is that when I use ROLL_OUT I'm not able to delete the targets ENTER_FRAME event.

[Code]...

View 2 Replies

Actionscript 3 :: Create Event Listener To Execute A Function When Object A Collides With Object B?

Mar 26, 2011

Alright, I've looked online at a bunch of different collision tutorials but they don't explain what I'm looking for. I want object A to hit object B and then execute a function via to a Event listener.

View 1 Replies







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