ActionScript 3.0 :: Loading Xml In One Class And Get In Other Class?
Oct 17, 2009
However I still feel confusing the question about loading.In fact I know in the testing result, the xml data is still running. I don't know how to fix it. Maybe I should say how to wait it complete the loading or something else i can do for other class calling it. As i just find many book, most of them only talking about using the addEventListener.
Code:
package{
import flash.display.*;
[code].......
View 4 Replies
Similar Posts:
Aug 18, 2009
I found myself loading a new XML file every day and so decided to create a small class that will load the xml file and return it.The class is loading the file but when i try to return it to a new xml object in the document class it doesnt load it.I think that it's something to with the return being in a nested function but i tried a few ways and non seems to work.
[DOCUMENT CLASS]
loadXML:LoadXML = new LoadXML();
myXML:XML = new XML(loadXML.loadXMLFile("gallery.xml"));[code].....
View 1 Replies
Jan 11, 2010
I have a Flex application that can load modules as necessary. When the first module is loaded, it creates a class MyBackground(), which paints the background red. When I choose to load a second module (and unload the first) I again load a class MyBackground (from the second module). However, when I step into the constructor for MyBackground, it goes straight into the constructor for the UIComponentDescriptor:
[Code]...
Is this something to do with using the same application domain for each module that I load? Does Flex load in the class types into the parent application and cache them, so when I request a class the second time it just does a lookup, without actually seeing if the class is the same?
View 1 Replies
Sep 17, 2010
I have two SWF files which I shall call container and slave. The slave file contains a movieclip that extends from a class I shall call base. base extends MovieClip and is compiled into an SWC. slave includes this SWC as a runtime library, while container includes it as merged (and does reference it so it should be compiled into the container SWF).
The container loads the slave like so:
bgURLRequest = new URLRequest(slaveUrl);
var context:LoaderContext = new LoaderContext(false, new ApplicationDomain( null ), SecurityDomain.currentDomain);
bgLoader.load(bgURLRequest, context);
When this loading happens, I get the error that class base was not found. I suspect this has something to do with the presence of the ApplicationDomain in there. I'm not sure what it does exactly, since I didn't write this loading code myself (but I do know that it's there for a reason so it can't be simply removed).
View 2 Replies
Jun 25, 2007
I'm having some problems importing a class, the message that Flash gives me is this; The class being compiled, 'ImageLoader', does not match the class that was imported, '[URL]'. The only line of code in my flash movie is this: import com.martijndevisser.*; And yes, the class is in that folder The class is from here: [URL] I've used the class before and it works fine, I just dont know what to do?
View 4 Replies
May 17, 2011
I'm new to Flash AS3. I started making a game and I am a bit confused. Let's assume that I want to create a game that has multiple levels/modes, how can I do this in an object orientated way?
When i create games in other languages e.g. XNA C#, i create a separate class then create an object of that class within the main class and run the game based on a simple statement.
[Code]...
View 2 Replies
Dec 19, 2011
I have an xml snippet that contains an object hierarchy:
doc = """
<RootObj val1="ValueOne" stat1="Stat1" stat2="Stat2">
<internalarray type="array">
<InternalObject val1="12" val2="12" />
<InternalObject val1="13" val2="13" />
[Code]...
View 1 Replies
Jan 10, 2010
This seems like it should be an easy one but I can't figure it out.I'm trying out a very simple class that, when created, loads and XML file into the class's property. I must be getting a basic concept tangled up here because I can see the XML coming in just fine in the handleComplete function, but the class property _result remains empty.What concept am I missing here?
public class MyClass
{
private var _result;
[code].....
View 1 Replies
Jan 23, 2009
I can't seem to get the XML outside of the class. Tracing it within the xmlLoaded function outputs the xml, but when calling the getXML(), it returns null, and when calling getXMLState(), it returns false.
here's the class:
Code:
package {
import flash.events.*;
import flash.net.*;
[code]....
and here's how i call it from another document.
Code:
import LoadXML;
var xml:LoadXML = new LoadXML("myxml.xml");
trace(xml.getXML());
View 2 Replies
Sep 21, 2005
I wrote a class (that extends the XMLSocket) and I am incorporating it into my project.However, I am finding that the class doesen't refresh when I test the movie, such as: I add a new property to the class and it isn't available to trace or use when I test the movie after saving the changes.
View 1 Replies
Nov 26, 2009
i am developing a AS2 class that loads a XML but i cant call a function from inside the onLoad function.
Heres the code:
Code:
// CONSTRUCTOR
public function Curso(target:MovieClip, path:String){
// set vars
this.path = path;
[code]....
View 1 Replies
Jan 24, 2010
I have a movie which is placed on the stage in the authoring environment, this movie is called LiftMovie. When the user clicks on a button in LiftMovie, it loads another movie into a placeholder called MallPlaceHolder and the LiftMovie has its visibility set to false.From the document class of the movie loaded into MallPlaceHolder, if the user clicks on the image of the Lift in the mall, I want it to make the LiftMovie visible again.
View 1 Replies
Jan 11, 2011
Im working with AS3 and in my application I have a base SWF (with its document class) main.swf / main.as
And I have several SWF that includes a video inside with some navigation code (some buttons that I code in individual classes for each SWF). The problem is that I cannot find a method to load the swf's right, because the event that triggers the load process happens in the loaded SWF (the child).
View 1 Replies
Jun 14, 2010
I found some code that let's you load variables from an external swf. I'm trying to adapt it so that I can use the symbols from external swf library in my main swf. I get an error telling me 'call to an undefined method...' and then the name of the symbol I am trying to import to the main swf (testMe123_MC). Here's the code of my external swf as:
[Code]...
View 1 Replies
Jul 26, 2010
What I am trying to do is to use shared runtime library by loading a swf ('index.swf') which has numerous library objects which are named in sequence such as:
(orange1,orange2,orange3,orange4)
(red1,red2,red3,red4)
I am able to load the swf('index.swf') without any issues and even am able to load the right library asset, but I have to declare the full name as string such as getDefinition('orange1'). What I would like to do is to match first three letters of string and then run a for loop to load up all the classes that match the first three letters. I usually can do this by employing indexOf() method.
here is my code:
public function loadContent():void
{
ldr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onloadHandler);
[Code]....
View 1 Replies
Jun 2, 2010
I have a class DataLoader.as:
ActionScript Code:
package {
import flash.events.Event;
import flash.net.*;
[Code]....
trace returns nothing...
when I write trace(myXML) in function onXMLLoaded after myXML = XML(loader.data), it's ok...
View 3 Replies
Dec 18, 2010
I have encountered a problem loading an external swf in my application. The external swf file is using a class and when I load it in my other flash it didnt load I think the class have a problem!!. I use the flash.system.ApplicationDomain and LoaderContext. It didn't have no effect in the my flash program.
View 0 Replies
Dec 12, 2011
Im working on a large project that requires text and images to load from an xml file. I have the text working like it should, but have problems with getting images. Its basically an interactive powerpoint IE: swf loads, shows menu selection buttons, when you click a lesson, you can go through different pages of info, I need to load images based on whatever page its on. Example: Lesson 1 has 4 pages of info, when you click the next button, a different picture needs to be displayed.
View 4 Replies
May 17, 2011
I'm trying to load an external swf that's controlled by an xml file as I have loaded other swfs, but I get an error saying that it can't locate the class of the swf that I'm trying to load, and now it wont display an error, but it still wont open.Here's the code that I'm using to load this file:
function Main2(fla:MovieClip,m:MovieClip)
{
var newSWFRequest=new URLRequest(event.target.name + ".swf");
loader2.load(newSWFRequest);
[code]....
how to load this file in as3 and if you can please tell me how to add/remove & edit buttons in this swf.
View 2 Replies
Dec 13, 2006
To me, it looks like flash is not loading the class because it doesn't do anything when I try a Tween command.I checked the class folders and it's there...
View 5 Replies
Nov 19, 2010
so from using both my Actionscript 3 Bible and a friendly tutorial here on Kirupa... and another online, I attempted to create a class to load an .swf. I worked through the Kirupa tutorial, and it worked, but I wanted it to be in a class! This is where the problems come, when I run it, I get no errors, the bar flashes as if it's full, and it loads the content. When I try to simulate download however, the screen stays white and I receive an error
"Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed."
View 1 Replies
Aug 16, 2010
I have two classes. The Main class calls a function, which is defined in a Second class.I'm getting the following error:Error 1120: Access of undefined property myFunctionBasically, I am creating buttons in the Main class that will add a corresponding Child to an Object in the Second class (if you click one button, child x1 will be added, if you click another button, child x2 will be added, and so forth).Here's the relevant code for the Main.as file:
package
{
import flash.display.MovieClip;
[code].....
View 3 Replies
Jan 29, 2012
If I have three classes:
public class Example {
public function Example () {
}[code]............
You can see that the two last classes extend the first one, and both have the 'variable' property. In case that I have an instance of Example and I am sure it is also an ExtendedExample OR AnotherExtendedExample instance, is there some way to access the 'variable' property? Something like
function functionThatReceivesAnExtendedExample (ex:Example):void {
if(some condition that I may need) {
ex.func()
View 3 Replies
Sep 23, 2009
package{
public class Character{
protected var _hp:uint = 50; //Character Health Points
protected var _power:uint = 5; //Damage dealt
[Code].....
I`m instancing a Character and a Player in the Main Timeline, all in frame 1.
When I use: ""player.attack(character)"" it works fine by itself.
So I added the if (defender._hp <= 0) this.win() which gives me the following error:
1061: Call to a possibly undefined method win through a reference with static type Character.
"defender" is a Character instance, "this" is a Player instance and "win()" is a Player method. I try to call the Player method inside a Character method using the Player instance adding the "." and his method name
Do I really need to define the win() function in the Character class? Is there a bypass to use a subclass method in a parent class method if it`s called from an instance of the subclass?
View 6 Replies
Nov 8, 2009
I have question regarding removing instantiated objects. Let's say i have a main class in which i instantiate a custom video player (or whatever) class:
Code:
...
var videoPlayer = new VideoPlayer(...);
addChild(videoPlayer);
...
And inside VideoPlayer class i have of course dozens of objects (movie clips, sprites representing different parts of VideoPlayer) and dozens of event listeners attached to them. My question is, if i want to remove this VideoPlayer class from my main class is it enough to just do:
[Code]...
View 2 Replies
Feb 14, 2011
i) Create a symbol called SimpleSquare. This should consist of a simple red square graphic
ii) Create a class file to define a class called SimpleSquare. This should be linked to the SimpleSquare symbol. SimpleSquare ashould have the following functionality: When the instance is placed on the Stage, it should start to disappear by decreasing its alpha at 0.01 in every frame (hint: alpha)
View 1 Replies
Feb 23, 2011
Assume I know practically nothing about AS3! I'm using Flash Pro CS5. I'm trying to reassociate a flash file I've been given with its external assets and classes. In the library I have a movieclip with linkage to a class called 'StaticMap' using the base class 'flash.display.MovieClip'. am I missing a custom class file called 'StaticMap.as' that was originally located in the same folder as the fla, or is this a generic class accessible to all movieClips from within Flash?
View 7 Replies
Apr 8, 2010
I have a initApp.as which instantiates a class which needs to access the "currentState" property and the States array as well. However we cannot get this to work as we cannot see how we can access this information.
Within initApp.as currentState is accessed via "this.currentState". This does not work in the class which is instatiated within initApp.as. The following error is thrown:
"Access of undefined property currentState."
View 1 Replies
Oct 14, 2010
I created an flv video player using Flash Builder 4. This "BasicVideoPlayer" project is compiled into a SWC that will be eventually be used to create other video players that extend the functionality. One of the features is a view that appears when the video has finished playing that displays a "Play Again" button. This "Play Again" view has its own class, "BasicPlayAgain", that accepts a graphic asset that is exported from a .fla file that contains all of the graphic/UI assets.
In my new project, "EnhancedVideoPlayer", I'm using the BasicVideoPlayer SWC as a library to create a new video player that will add more functionality to the "Play Again" view; specifically it will add more buttons to that view.The EnhancedVideoPlayer uses a default class that extends the BasicVideoPlayer class. The BasicVideoPlayer class has a member called "playAgainScreen" whose type is BasicPlayAgain. The EnhancedVideoPlayer needs to override the playAgain member and recast it as EnhancedPlayAgain so it can control the new buttons properly.
View 1 Replies
Feb 17, 2011
Is there a way to generate an instance of a class that implements an interface based on the name of the class?
I am trying:
var ClassReference:Object = getDefinitionByName("movement.OuterSpaceMovement") as IMovement;
var m:IMovement = new ClassReference as IMovement;
trace("startup..." + m);
-But I am getting an error message ReferenceError: Error #1065 (OuterSpaceMovement) not defined.
I have several classes that implement the same interface (IMovement) but I need to be able to generate new instances of these classes and then pass these instances as a datatype (IMovement datatype) to other classes...
So then I tried:
var ClassReference:Class = getDefinitionByName("OuterSpaceMovement") as Class;
var m:IMovement = new ClassReference() as IMovement;
and this doesn't seem to work...but the following
var m:IMovement = new OuterSpaceMovement();
View 1 Replies