Actionscript 3.0 :: Share XML Data Between Custom Classes?
Apr 26, 2011
I have an application where I'm loading in XML data externally. What i'm trying to figure out is the best way to store this data in my application so that I can pass the relevant XML or data to my custom classes.
Basically I have a navigation and gallery class I have written both of which are instantiated on the document class, I would like to pass them each their corresponding XML. My question is whether I should store or seperate the xml into objects in the document class first, or simply pass each class its own xml node? Is there another/more preferable way to handle XML data between custom classes?
View 2 Replies
Similar Posts:
Apr 26, 2011
I've been working in as3 for quite a while now, trying various methods of loading in XML and parsing it between custom classes - from storing the XML data using objects, storing it in arrays and then parsing it to my custom classes, or parsing XML nodes directly between their relevant classes. how best to store and parse data from XML throughout my classes.
Should I be extracting it all in the document class first, into arrays or objects, and then parsing the array or object to the relevant class? Or simply parsing the XML node that relates to the class and extracting the data there?I've also heard that looping through XML and storing the data in multi-dimentional arrays before parsing it, is the way to go.. some have also suggested using a separate public data class or singleton class to store all the variable data from xml.. and referencing it globally in each class.
View 3 Replies
Apr 26, 2011
I've been working in as3 for quite a while now, trying various methods of loading in XML and parsing it between classes - from storing the XML data using objects, storing it in arrays, or parsing XML nodes directly between their relevant classes. Should I be extracting it all in the document class first, into arrays, or objects and then parsing the array or object to the relevant class? Or simply parsing the XML node that relates to the class and extracting it there?I've also heard that looping through XML and storing the data in multi-dimentional arrays before parsing it, is the way to go.. some have also suggested using a separate public data class to store all the variables from xml.. and referencing it globally.
View 0 Replies
Oct 27, 2010
How can I get some var / data from a custom classes?The XML class
package classes
{
import flash.net.URLLoader;
[code].....
View 3 Replies
Aug 30, 2006
I began with a class for a movie clip rollover function FigureRollOver. It works marvellously. Three things happen:
1) it loads XML from a file "mod1_fig1.xml" and uses another class, XMLMember, to retool the scoping of the XML so that I can get at it
2) an onload call inside of XMLMember calls the myOnLoad function and transfers the XML into an array.
3) so long as the array is finished building, rolling over a movie clip attaches a new movie clip with the rollover text in it.But I don't want all those functions in one because I need it to be more dynamic, starting with being able to load any old xml file instead of just "mod1_fig1.xml", plus it seems lik overbuilding to have all of that in one class, so I've separated out the loading of the XML and building of the array into its own class, FigureXMLLoader. FigureRollOver is then left to just attach the rollover with text in it, extracted from the array built by the new class.
Problem is, though the array builds inside FigureXMLLoader, I can't figure out how to make it available outside the class. I know that I'm constructing things in the wrong order, and that the array needs to be somehow built inside the class function to be available, but I can't figure out how to do that. A cruddy work-around is to put a function call at the end of the building of the array, which calls yet ANOTHER function on the main timeline of my .swf to put the array I've just built into a new variable.This works, but it's messy. It seems like I should be able to have one line of script in the .swf that generates an array on the main timeline (or just a public array) which I can then access from my FigureRollOver class:
var myRollOvers:Array = new FigureXMLLoader("mod1_fig1.xml");
Here is FigureXMLLoader (see comments in the code for more details) which obviously does not return an array as it is, because of all the working around I've had to do. Note the "testing" variable, which can be traced from the main timeline of the .swf, but I will get "not what I want" because of course the array hasn't been built yet, and never will be, inside of the declaration as it is. How do I get it in there so I can return an array?
View 2 Replies
May 28, 2011
Assume i have a custom actionscript class. [code]...
Suppose also that i have a different class, that changes a second variable, which has the metadatatag [Bindable]. What methods and events do i have to implement in either of these classes, to make myVariable change, whenever the other is changend?
View 1 Replies
Jun 25, 2009
I've created a base class to house some basic functions I'd like to have across several movie clips in a game I'm making, however, when I link a custom class to the same movie clip I get the message; "The base class will not be used because the class specified is already defined and extends its own subclass. If you wish to use the base class, specify a class name in the Class field that will be auto-generated or enter the default base class 'flash.display.MovieClip' in the Base Class field." I removed the 'extends MovieClip' inside the Class but it still shows the message. Does this mean that I cannot use a custom class and a custom base class on a movie clip?
View 2 Replies
Aug 13, 2011
So i have a situation where i want to pass a object of a class say 'MyBigAwesomeClass' from a child to a parent. I import the class definition into both the parent and child. Now, if i load the child swf from a location that is relative to the location of the parent , all is fine, however the moment i load it using a full absolute path, it treats the definitions for 'BigAwesomeClass' in parent and in child as different and does not allow an object of the type 'BigAwesomeClass' to be assigned to an object of the same in the parent class.I am totally stumped, and have banged my head over ApplicationDomains, including using this code
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,swfLoaded);
var context:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
loader.load(new URLRequest(_file.url),context);
[code].....
View 4 Replies
Aug 27, 2011
I want to share an Array which all classes can "get" and "change" data inside that array. Something like a Global array or Multi Access array. How this is possible with ActionScript 3.0 ?
View 2 Replies
Apr 3, 2009
I have a flash site which is going to have a concertina menu and various other features. I need to know if the menu is active or inactive so am using a Global variables class to do this. I have a couple of questions.(i) is this a legitimate technique, to have globals to store and share the state of the menu between all my classes(active or inactive)(ii) What should (if anything) the globals class extend?Also I create my global like this
package
{
public class MyGlobal
{
public var test:String;
[code]....
View 3 Replies
Sep 23, 2003
anyone have any good links or there own AS they want to share for custom scroll bars?
View 3 Replies
Aug 30, 2009
Is there any way to exchange data between 2 swf's?
View 2 Replies
Jul 9, 2009
I have a Flex application that I'm working on for a new job. It's sort of a training wheels application -- I'm learning the language, and this isn't an app that needs to talk to a service in order to do its job. There are a few instances of combo boxes throughout the application that share the same set of possible values (say, a selection of states: "In Progress", "Rejected", "Complete") that I want to have use the same data source.
What is the best way to manage this?
View 2 Replies
Sep 22, 2004
alright.. recently i needed to share data between different flash .swfs on a homepage.. so i tried to use Shared Objects to do so. sofar its fine.. i tried it .. and as long as the data is stored on my harddisk. the sharedObject "cookies" work fine.. but when i put the site online.. they simply dont work anymore..
could this have something to do with security settings of the browser used?.. doesnt a web browser allow flash to access the harddisk to read and write shared objects.. is there another.. simpler and more reliable way to send data from one .swf file to another..?? (without using php -> my webserver doesnt support this sofar )
View 1 Replies
Jan 12, 2011
How to share TextArea Component in multiple swfsaylib.swf (has TextArea Componenet)main.swf (Import TextArea Componenet from lib.swf)section.swf (Import TextArea Componenet from lib.swf)
View 1 Replies
Jan 4, 2010
I am trying to create a login system where a user would be able to login inside of one flash game on say, [URL], and then that same login data would be preserved for all the games on [URL] and also the games on [URL] and [URL] I am new to shared objects in flash so if anybody knows of a way to do this in either php, as3, html, js (or a mixture of all) then that would be great.
(PS. I would prefer not to use a method that requires a javascript bridge to retrieve cookies as this is impossible for games that are played on game-portal sites where only a swf file is used)
View 1 Replies
Jun 23, 2011
I am using a local connection to share data between 2 apps. The receiver has a function that runs every time new data is sent. I need to run another function every time that function runs, how can i do this?
View 2 Replies
Sep 22, 2004
recently i needed to share data between different flash .swfs on a homepage.. so i tried to use Shared Objects to do so..
sofar its fine.. i tried it .. and as long as the data is stored on my harddisk.. the sharedObject "cookies" work fine.. but when i put the site online.. they simply dont work anymore..
could this have something to do with security settings of the browser used?. doesnt a web browser allow flash to access the harddisk to read and write shared objects..
is there another.. simpler and more reliable way to send data from one .swf file to another..?? (without using php -> my webserver doesnt support this sofar )
View 1 Replies
Feb 19, 2012
I work in a theatre and I'm looking to create a seat map that can be shown to members of the public as they book their seats, so they can see where they are going to be sitting. The main problem I've come up against is that the person viewing the application, will not be using it. I need the Box Office clerk to be able to input data, and then the seating plan shows the seats on a second monitor (public facing)
What I thought of doing was to create 2 flash applications and used Shared Objects to pass data from one to the other. In the Clerk application, they would input the seats that are being requested and click Submit (or whatever). In the Public application, these seats would then be highlighted. Ideally, another dynamic image would change to show the view from that general area of seating.
View 27 Replies
Apr 8, 2010
I use multiple custom classes like tweenlite, csvparse, papervision and many more. The way I do is put them in one central location and edit Flash CS4 Actionscript 3.0 settings to include that location.The problem I face is even though I don't use all the classes in a project, flash CS4 compiles every single class that is in that central location eventually increasing my compile time by minutes.
View 5 Replies
Aug 26, 2009
Is there any way to get a list of custom classes? I'd like to be able to dynamically access the custom classes (that I've created by the "Export for Actionscript" checkbox in the "Linkage" dialog) without having to hard-code their names into the script.
View 2 Replies
Jun 5, 2009
[code]This is my document class, with the Textfields beeing placed on stage.While this all compiles and displays fine I do not get the trace output for the text fields, actually the only trace I get is "constructing". I tried it without the "each" keyword but to no avail as well.
View 3 Replies
Jul 26, 2009
I'm looking to extend Vector.<T>, but it's final, so I'm going to have to include it as a member instead.Regardless, I'd like to make the wrapper class type independant, so I was wondering what the snytax for template classes are.
View 6 Replies
Dec 26, 2009
Lets suppose, I have a class with so many public properties
class person{
public var address:String;
public var name:String;
public var fathername:String;
//etc etc
}
Now i want to iterate over them in a simple way like
for (var key:string in person){
trace("property is " + key + " and value is " + person[key]);
}
But AS3 doesnt allow this to do with Classes
what would be the better and simple way to iterate over them as i dont want to do so many if(else) on it.
View 8 Replies
Aug 28, 2009
i'm still in the process of grasping my move from AS2 to AS3 (or from timeline coding to external classes), and here's a problem i've run into.i have two classes, for the sake of easiness, call them Class1 and Class2.in frame 1, if i have
ActionScript Code:
var c1:Class1 = new Class1();
var c2:Class2 = new Class2();
[code]....
View 4 Replies
Sep 10, 2009
How do I let a custom classes know, what I've done at other classes,so that it would run an action accordingly?a function in the button classes:
ActionScript Code:
public function btnClick(event:MouseEvent):void {
var zoomF:theZoom = new theZoom();
[code].....
View 2 Replies
Dec 14, 2010
Say I have a document class called index, where I set up some variables and methods and include a class.
I get this error:
Error: Error #2136: The SWF file file: index.swf contains invalid data.
at com::index/initIndex()
at com::index()
[Code]...
View 2 Replies
Sep 29, 2005
I'm trying to get a button to change color via a Custom class written in ActionScript. I have built and attached an example to show you all what I'm trying to achieve. The code works perfectly with a MovieClip, but when I try to apply it to a Button, it falls flat (can't even find the reference to the button it seems). On my stage are two objects:
1. A Movie Clip
2. A Button
These are both set to "Export for ActionScript", and have an attached class called 'ColorClass'. ColorClass is basically what does all the work (makes a Color object, and has set and get methods). I also have an action layer where all my other code is contained. I'm fairly new to ActionScript, but come from a Java background
View 1 Replies
Oct 30, 2006
im trying to port my code to as3 but i stumbled on a problem i have no idea how to fix.
error report:
Code:
verify PointAirFri$iinit()
stack:
scope: [global Object$ Point$ PointAirFri$]
locals: PointAirFri Number Number Number
0:getlocal0
stack: PointAirFri
scope: [global Object$ Point$ PointAirFri$]
locals: PointAirFri Number Number Number
1:pushundefined
stack: PointAirFri void?
scope: [global Object$ Point$ PointAirFri$]
locals: PointAirFri Number Number Number
2:setslot 14
stack:
scope: [global Object$ Point$ PointAirFri$]
locals: PointAirFri Number Number Number
4:abs_jump 78424138 45
stack:
scope: [global Object$ Point$ PointAirFri$]
locals: PointAirFri Number Number Number
0:getlocal0
stack: PointAirFri
scope: [global Object$ Point$ PointAirFri$]
locals: PointAirFri Number Number Number
1:pushscope
stack:
scope: [global Object$ Point$ PointAirFri$] PointAirFri
locals: PointAirFri Number Number Number
2:getlocal0
stack: PointAirFri
scope: [global Object$ Point$ PointAirFri$] PointAirFri
locals: PointAirFri Number Number Number
3:constructsuper 0
VerifyError: Error #1063: Argument count mismatch on Point$iinit(). Expected 3, got 0.
at PointAirFri$iinit()
at docClass/::init()
at docClass$iinit()
this is how the defined the classes:
Code:
package{
public class Point
{
vars
public function verlet(a)
{
code
}
public function savePoint()
{;
code
}
public function restore()
{
code
}
public function Point(__x:Number, __y:Number, __fr:Number)
{
x = __x;
y = __y;
dx = 0;
dy = 0;
vx = 0;
vy = 0;
friction = __fr;
}
}
}
package{
import Point;
public class PointAirFri extends Point
{
private var airFriction;
public override function verlet (a)
{
code
}
public function PointAirFri(__x:Number, __y:Number, __afr:Number)
{
x = __x;
y = __y;
dx = 0;
dy = 0;
vx = 0;
vy = 0;
airFriction=__afr;
}
}
}
if anyone has any idea why that error happens please enlighten me
View 2 Replies
Feb 10, 2007
I have a few custom classes stored in AS files. Is it possible to have these classes imported another way from using the following method:
Code:
import ClassFile;
I want to have the AS files loaded from a server (policy file created for inter-domain talk) into to flash. Also I want it to work, if a person downloads the main SWF and plays it on their compy,i want the class files to be loaded from [URL] and so on.
View 5 Replies