ActionScript 3.0 :: Access A Sprite On A "loaded" Swf From Parent Stage?
Aug 5, 2009
I am creating a Flash training app that includes a glossary. You click a button and the glossary opens. The glossary loads thus:
PHP Code:
var request:URLRequest = new URLRequest("glossary.swf");
var loader:Loader = new Loader()
loader.load(request);
swfCont.addChild(loader);
The glossary has a scrollbar, and that scrollbar has this listener (among other things):
PHP Code:
scrollbar.addEventListener(MouseEvent.MOUSE_UP, stopScroll);
Once the glossary is loaded into my app, if I do a MOUSE_DOWN on the scrollbar and then drag the mouse away from the glossary, onto the parent stage, then when I do a MOUSE_UP on the parent stage, I need to dispatch a new MouseEvent.MOUSE_UP event to the scrollbar in the glossary swf.
How do I access the scrollbar of glossary.swf in my dispatchEvent? In other words, in the following code in the parent:
PHP Code:
stage.addEventListener(MouseEvent.MOUSE_UP, glossarySBMouseUp);
function glossarySBMouseUp(me:MouseEvent):void {
xxx.dispatchEvent (new MouseEvent(MouseEvent.MOUSE_UP));
}
View 2 Replies
Similar Posts:
Oct 25, 2009
From the two .as files below, I get the following error when I run: 1119: Access of possibly undefined property importantNumber through a reference with static type flash.display:Sprite.
[Code]...
View 2 Replies
Jan 21, 2011
I'll give a complete explanation of what I'm trying to do. I have a video player as a separate SWF. In this video player I have a VideoContainer class extending Sprite, which contains the video and a control bar with specific video buttons.
This SWF is loaded in another main SWF, which has a menu that is on top of everything else. When I click "Fullscreen" in the video SWF, everything goes smoothly, except the menu remains on top of the VideoContainer object.
I need a way to change the display order of the loaded SWF, to put it on top of everything else on Fullscreen and change it back when Fullscreen goes off. All this needs to be made inside the video player. Also, the configuration of the children can change (the video player can be loaded in different places in the main SWF), so I can't use a certain unchanging path.
View 2 Replies
Jun 25, 2009
I want to load an external swf movie into the parent one using for example the UILoader component and I want it to have access only to one object of the parent (the main swf movie). I tried sth like my_uiloader.content.parent = null, but obviously it doesn't work as the parent property is read-only.
View 15 Replies
Jul 10, 2009
I'm currently making a platform game and when the player shoots i want to add the bullets to the stage. The players gun class is in charge of adding bullets. The "players gun" is a child of "players gun holder" which is a child of "player" which is a child of the stage. is there a better or more dynamic way for the "players gun" to add bullets to the stage rather than using parent.parent.parent.addChild (bullet);
View 2 Replies
Sep 14, 2010
Imagine the following setup. The main swf loads a child swf.In AS2 i would simply use _parent or _root to call the desired function. How can that be done in AS3?Can this still be done? Can I call a function on the main swf from the loaded one? How about the other way around, this time, from main to loaded swf?
View 1 Replies
Feb 24, 2010
I am executing the lightbox functionality from a swf file that is loaded by a parent swf. For testing purposes, when the lightbox button is clicked, the image should fill the entire stage. Even though both the loaded swf and the parent swf recognize the same stage dimensions at all times(validated through tracing statements) and the lightbox image is positioned to the top/left corner of the stage, the image instead aligns to the top/left corner of the loaded swf. And if the stage is resized after the lightbox image is displayed, the container MC (which is located in the parent swf and centers all the sites content) re-aligns to the top/left corner of the stage .[code]...
View 1 Replies
Mar 7, 2009
I have a MainClass from where I can call Stage. In the MainClass I call another class named Subclass, and in that one I call my ThirdClass. ThirdClass is initialized fine, but my problem appears when I want to call the Stage within the ThirdClass, to align the Stage. When I compile I receive the message: 1119: Access of possibly undefined property align through a reference with static type Class.
[Code]...
View 4 Replies
Feb 10, 2012
If I have a swf that's being loaded into other peoples' swfs (which I have no control over) is there any way I can get properties from the stage (such as height, width, fullScreenHeight, etc.) or does this have to be exposed by the loading swf?
View 1 Replies
Aug 27, 2009
I have a Flex project where I am loading in 3 external swf's. Each of these swf's represent their own projects, each with its own stage. In each of these sub-projects I reference their stage from within, but this does not work once they are loaded into the Main.
I eventually got the contents to display, realizing that stage will return null unless ADDED_TO_STAGE is complete in externally loaded swf's. Unfortunately the way I did it, I am now adding to the Main's stage instead of the swf's stage.
Code:
public static var mainStage:Stage;
public function Program()
{
[Code].....
I assuming that even though i'm in Program.swf, this.stage is still referring to the parent swf?
View 3 Replies
Jul 29, 2010
Is it possible to access a function within a function in a parent swf from a loaded swf?
View 6 Replies
Mar 15, 2011
I am trying to access a function that is on my document class for my AS3 project, from a nested class. That is, the Document Class calls Class A which then calls Class B. So I am trying to access a function from Class B, I am trying to use MovieClip(parent).function(); but I am getting error 1120. The MovieClip(parent) (fixed to reflect my document class, etc) works when I try it from other classes but not from this nested class.
View 9 Replies
Sep 11, 2010
if I add a clip to the stage as a child and remove the parent and set the parent equal to null, does the child get collected and removed from memory? What if the child has an image loaded into it as its child?
In my application I'm loading a series of png images as overlays that can be tinted for customizing in this app. When I trace my memory, the basic app idles at 64,000 k. The exact second I load those overlay images it goes up to 205,000k. If I remove those clips and "clear" the stage I should go back down to 64,000 k if everything is removed and collected correctly, right? It's not, it's hanging at 215,000 k. Are my images being cached and that is the reason for the memory staying up? If so, how do I prevent that. Or upon removing the parent of the image how can I un-cache the image.
If a user switches between models and loads several different items then the application actually crashes the Flash environment because of too much memory usage. It also does the same to browsers.
View 29 Replies
Jul 27, 2010
Given this:
PHP Code:
var container:Sprite = new Sprite();
var _myriad = new _Myriad();
var tff:TextFormat = new TextFormat(_myriad.fontName, 24);
[Code]....
...why is it that I can see my text when I do this:
PHP Code:
addChild(tf);
but I can't see my text when I do this:
PHP Code:
container.addChild(tf);
View 2 Replies
Apr 1, 2010
I have a sprite A which has a child, sprite B.Sprite B has a variable, instance of class C which only extends EventDispatcherIn class C, I dispatch a custom Event. The eventlistener in sprite B reacts on the event.The same eventlistener in class A doesn't respond.If I dispatch the same custom event in the eventhandler in class / sprite B, this event is seen in class / sprite A.Is there a difference in events going through the displaylist and those who are from an EventDispatcher?
View 6 Replies
Oct 16, 2011
what I'm trying to do is accessingsnapText = scrollPane.source.textSnapshot;from an external swf. I've tried:
trace("-->: "+scrollPane.source.textSnapshot.getText(0, 1000));
trace("-->: "+myLoader.content.textSnapshot.getText(0, 1000));
trace("-->: "+mc.textSnapshot.getText(0, 1000));
[code].....
View 3 Replies
Dec 10, 2010
I'm trying to simulate some fade in/out effects in Action Script 3 programmatically, using Timer class and controlling alpha property of the specified DisplayObject in time. In general it works and looks great. As I was expecting. But after I add some more child DisplayObjects to the parent Sprite it starts to behave weirdly. Children seem to not fade at the same rate as parent object and it visually noticeable, and ugly. There seems to be a short lag after parent already started to fade out and before children actually follow. Are there any additional measures I should take to avoid that? I do alpha manipulation only on parent object. I thought that'd be logical...
View 2 Replies
Sep 23, 2010
I have a shell swf that is loading a swf. How do you have the loaded swf tell the parent loader to unload itself after the loaded swf finishes playing?
View 4 Replies
Jun 14, 2011
Im working on a project that has a main swf file associated with the document class. It loads XML that provides the text content for the project, then it loads a swf that contains a font in its library, then it loads the first of several content module swfs. When the font swf has inited, I'm registering its library font with Font.registerFont(), and using it in a TextFormat object. After everything is done, I can add code to the document class to create a text field on the stage of the main swf and format it successfully with the TextFormat object, but when I try to do the same thing inside the loaded content module swf, the text doesn't show up there at all.
View 1 Replies
Jun 15, 2011
I'm working on a project that has a main swf file associated with the document class. It loads XML that provides the text content for the project, then it loads a swf that contains a font in its library, then it loads the first of several content module swfs. When the font swf has inited, I'm registering its library font with Font.registerFont(), and using it in a TextFormat object. After everything is done, I can add code to the document class to create a text field on the stage of the main swf and format it successfully with the TextFormat object, but when I try to do the same thing inside the loaded content module swf, the text doesn't show up there at all.
View 7 Replies
Jun 6, 2011
i am slightly confused about the parent and child relationship. lets assume we have several different instances, what would be difference of adding them all as children of the stage and creating a parent-child hierarchy between them(other than the access path).
View 5 Replies
Mar 12, 2010
If I change some value for a parent sprite, the same value will affect all of its children. So if I set alpha or width on the parent, the child will automaticly get the same value.
View 4 Replies
Apr 20, 2009
I have a child class that is loaded into the parent class when the swf begins, like so: var myvar = 'hello'; public function Parent() { this.child = new Child(); }; How can I retrieve the variable 'myvar' from within child?
View 1 Replies
Jan 13, 2010
I need to create a complex html displaying in a textfield so I'm looking right now at a few options. The simplest would be to use an img tag so I can add a few Sprite coming from the library. Problem is I can't seem to find a way to modify or pass values to the Sprite that is created that way.
View 9 Replies
Jul 27, 2010
I"m new to AS3 and I would like to know how can I get to graphics of a Sprite so I could draw it directly from it. I mean I don"t want to use Sprite class as my concrete objects I just want Sprite to hold graphics so if my own object needs to be drawn it asks for graphics to SpriteManager which returns Sprite with required graphics and draws it exactly where I want to not where Sprite's coordinates points to.
View 1 Replies
Dec 18, 2010
I have the following class:
package {
import flash.display.Sprite;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
[Code]...
Is there a way to access the properties directly? I tried making this = new new swfShip() but that doesn't work.
View 3 Replies
Oct 5, 2009
Through getChildByName is it possible to access the mouseChildren property of a Sprite? I'm guessing no, but before I go about changing something I want to make sure it's necessary and that I'm not just doing something wrong..
ex:
Code:
STAGE.getChildByName('container').mouseChildren = false;
Would give me an error. I see this is because getChildByName returns a DisplayObject object. So I guess my question is: Is it possible to get the actual Object (Sprite in my case)?
View 2 Replies
Dec 21, 2011
I want to get my star to use one of the loaded sprites, I manage to find the correct urlLoader in my loader, but are unsure what I should return to give it the sprite.[code]...
View 2 Replies
Jul 3, 2009
I have created an renderer to modify the content of one of the columns of the DataGrid.
Code:
package {
import fl.containers.UILoader;
import fl.controls.listClasses.ICellRenderer;[code].....
but how can i access the parent DataGrid or anything outside of this class ? In Java it can be done, but how can i pass any value to this class.My use case is that i click on a delete button and the row is deleted, impossible to do if i cannot access the parent DataGrid and call methods to work with it.
View 4 Replies
Aug 24, 2009
I have an SWF file that loads another SWF file dynamically.
I've managed to make the parent SWF receive a variable from the php page that loads it, via javascript, it works well [code]...
View 1 Replies