ActionScript 3.0 :: How To Expose Property Of Loaded SWF
Sep 2, 2010
I'm extending / modifying this tutorial to create a runtime asset loader class. Kinda got it working, but in efforts to streamline it, ran into this issue:
- doc class for external library swf:
ActionScript Code:
package com.b99.runtimeLib {
import com.b99.utils.IRuntimeLibrary;
import flash.display.MovieClip;
[Code] .....
In this case, ASSET_DEF is returning undefined, and isn't showing up as a property during debug. How to expose this property to the loading class?
I created a flex component that hosts several built in (mx) components such as a listbox and combo box. My component relies on external data, and I need to expose events such as ComboBox.enter and List.click to get certain pieces of data.I was wondering if there is any easy way to do this without having to create my own custom event handlers. I'm simply trying to expose these events with different names so that when my component is used, I can do things such as:
I have a class member in an ActionScript 3 class that looks something like this:
private var m_myvect :Vector.<MyType> = new <MyType>[];
I'm exposing it through a getter, like this:
public function get mydata() :Vector.<MyType>
Which doesn't help when I use it like this:
for (var o:Object in inst.mydata) { ... }
... because the type of o is not MyType, but Number instead, because it enumerates the vector indices instead of the data.How would I expose only the data within the vector in a way which:Does not expose the data in a way which allows it to be modified?
I have a issue where I'm working with a particular interface for quite a lot of things. However, I have a particular method that I want to be available only to a particular group of classes (basically, an internal method). [code]...
I am creating a library in AS3. Inside the library I make use of a bunch of classes/packages that need not be exposed to the end user of my lib. I want to only expose one of these classes.
I guess my questions are:
1) How are libraries commonly distributed in AS3?
2) Is there a .jar equivalent in AS3 that developers can include, but will only have access/knowledge of the classes I've declared as public?
Ive a quick question on using root property when swf's are loaded in other swf's. Is it safe/wise to reference MovieClip(this.root) in packages/classes if the swf will be loaded and placed inside another swf? I read once that root will always refer to maintimeline, and all objects have the same root. So...will the root change in some way if a preloader loads the main swf?
I am getting the following error when I importmy swf onto my main stage: TypeError: Error #1009: Cannot access a property or method of a null object reference.
at FtScrollBar/set useMouseWheel() at ButtonsMenu_fla::buttonsScrollingMenu_1/ButtonsMenu_fla::__setProp_sb1_buttonsScrollingMen u_ScrollBarComponent_1() at ButtonsMenu_fla::buttonsScrollingMenu_1$iinit()[code].....
On it's own the carousel works fine, it's only when I import it that it throws an error, all of the components within the carousel work fine (the images are highlighted on mouse over, the onclick code for the thumbs runs the right functions) it's just the scrolling that doesn't work.I've tried removing the references to stage from the loaded swf but I still get the same errors.I'm fairly new to flash but I'm finding the error messages to be fairly unhelpful at the best of times, I've attached the swf I'm trying to load in in a zip
i have one main.fla, its document class is main.as. the code in main.as is package.[code]where val is the property of Loading class.so how can i access.
Does anyone know of a workaround for loading an AS3 swf into an existing AIR/Flex (Flex 3) application and having the loaded SWF retain its own reference to its stage (not the loader's stage)?
I've tried the loadForCompatibility property on SWFLoader, but that isn't giving me the behavior I'm wanting. The loaded swf still has the main AIR app's stage set.
I try access to (MySWF(movieClip)).id but I get a weird message error: 1120: Access of undefined property aslider Which is defined in MySWF.init. If I remove (MySWF(movieClip)).id program works perfect! Isn't this weird especially as I have added addEventListener(Event.ADDED_TO_STAGE, init); in MySWF constructor to ensure that aslider is on the stage.
In main: private var idMySWF:int; public function loadMySWF(event:MouseEvent) { idMySWF = 1; var myLoader:Loader = new Loader(); myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete); [Code] .....
A have a external SWF file that contains an instance of an object that will be used across multiple projects. It's accessible as a public property of the external SWF.When I load the external SWF file using the Loader class everything comes in fine but when I try to assign the value of that property, which traces out as an instance of the correct object, to a local variable the local variable is always null.Below is a dumbed down sample of what I'm trying to accomplish:# Object Class
i have a UILoader that loads an image from an xml list when you click its thumbnail ( in its thumbnails mc on mainstage aswell) thing is, i have another UILoader on the layer above that loads in a swf ( a slideshow that fades in and out the pictures when they change to the next, with all the coding on frame 1, frame 2 only has a stop and some code for when the mouse is idle for 5 secs it goes back to frame 1) so when you go to "portraits" it takes you to frame "x" where the slideshow ( loaded external swf ) starts playing automaticly right, if i click any thumbnail the slideshow goes to frame 2 ( wich is perfect and the mouse idle thing i wanted works great ) the ONLY THING IS
after the slideshow runs by default for the first time ( i enter the category portraits ) and i click any thumbnail ( moving slideshow swf to frame 2 enabling mouse idle event ) and the mouse is idle ( so it does the event and starts playing the slideshow again ( goes back to frame 1 ) ) I CANT MAKE THE UILOADER OF THE THUMBS IMAGE TO DISSAPPEAR!
I have been trying to get my style sheet to load for 3 days now and I have to say I am at my wits end, does not help that I am a newbie. I have built a flash site at[url].....
I have an action script (3.0) that when you click on a link it calls content to slide in from the left and then clicking on another link the old content slides off and the new content slides in. I have been trying to get style sheets working with my xml which are now working in the editor but I cannot get my style sheet to load in Flash CS4 and Action Script 3. I could not figure out where to put the css code in the action script so have been loading it separately on frame 1 in my movie.I keep getting "1120: Access of undefined property" My code is
To make this a little more complicated I have a layer called content which contains a movie clip called mover_mc and inside this I have a textfield called myText. This is set to be dynamic and multiline. My stylesheet is called sample.css.I load up to mover_mc or the actual text field and when I see examples that have MyCSS do I change this to the name of my style sheet.If I change the stylesheet object to
//Create a new style sheet object var sample = new myText.StyleSheet(); var sample.load("sample.css"); myText.styleSheet = sample;
I then get an error - 1086: Syntax error: expecting semicolon before dot. I have attached my XML action script, CSS file and one of my xml files as well.
I have 2 EXTERNAL movies being loaded with initial load of my site into my main.swf, one of which (movingbg.swf) is being loaded with a preloader. The problem is that my other movie (menubar.swf) is loaded before my first movie. I think I should use the _visible property to solve this and here is what I have so far...
I have a movieclip with two frames. Each frame has externally loaded text with associated CSS. The first frame works fine. However, when I click the button that takes me to frame 2 I get this error:
Setting the text property of a flex DateField makes the selectedDate property of that DateField go to null.I need to set the text property so that I can use a particular format (DD-MMM-YYYY).
Lately i discovered MATE (for Flex development) and was wondering: how do i bind a property in a view (actually a navigatorcontent component) to another property in a class so that they stay in synchronization (meaning that whenever the property in the class changes the property in the view also changes).
So if we have a view called Target.mxml and a property targertProp how do we bind it to the class called SourceClass with property SourceProp?
What's the difference between selectedChild property and selectedIndex property? I read the documentation, both seems to be setting currect active accordion. selectedChild can be only used in actionscript, but other than this, what's the difference?
Can we put [Bindable] on functions/methods? I know that bindable is used to change the value of the source property to destination property. But not sure if we can use that for methods. why we cannot put/ if we can then what will be the outcome?
I have a class Inhabitant with a property skin which is of type DisplayObject.
Within Inhabitant I need to access the x and y properties of skin using this method:
this["someProperty"]; Rather than: this.someProperty;
This is fine with properties defined within Inhabitant but I'm not sure how I could do this for a property of skin. This obviously doesn't work but it might give you an idea of what I'm trying to do:
this["skin.x"];
The reason behind requiring this notation is that I have a function which I can parse a String though that will represent a property:
public function addTokenable(property:String):void { if(!isTokenable(property)) _tokenables[property] = true; }
And then a related getter that will return a representation of this instance of Inhabitant as a String:
public function get token():String { _token = "class:" + getQualifiedClassName(this).split("::").join(".");
I'm wondering if there is a way I can bind a flex property to flash property?, the flash property is inside a swc file created in flash with the Flex Component Kit for Flash Professional, I can manipulate the flash component as a regular flex component, but I want to bind their properties, is there a way?
I can only explain this by an example; so:I have 2 classes and one of them includes the other as a getter/setter property.I need the following code to return the same result:second.first.X = 1; //but it does not. ( ExpectedMethod() is NOT fired. )
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?
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.
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.
I am in the process of building a site for an Architect... Jamie Fobert Architects (projects) I am useing transitions between the projects and am loading details/text and images externally through flashvars, php and a mySQL database. Within my transitions I have a a preloader on the forst 2 frames the code is as follows (taken from a Voetsjoeba tutorial):
[Code]....
This works pretty well if the content is within the .swf, but when it is loaded externally it doesnt preload it at all. Does anyone know how I can adapt/improve this preloader? or somehow ensure that all the content being loaded externally is loaded before the transition plays?
I have three btns on stage, clicking on each one i want them to load an external mp3.The problem is the previous loaded sound doesn't stop when a new one is loaded so I have all sounds playing at the same time