ActionScript 3.0 :: Can SharedObjects Store Custom Classes?
Jun 13, 2009
I have a an array of a custom class that I'm trying to store in a SharedObject.Storing is working fine, but when I recall the SO next compile it only returns an array of generic Objects instead of my custom class. This only happens with custom classes.Code excerpt below, this may be way too cut out, but it seems it's what I've narrowed the problem down too.[code]
View 2 Replies
Similar Posts:
Oct 9, 2009
I am trying to make a little picture store for my website.I want to store the items in sharedObjects, so the next time people come to my site the selected pictures are there for them.I learned a little bit of sharedObjects and make it work for me with Strings but I can't make it work with and Array.
View 3 Replies
Aug 26, 2011
I am working on a flex project using sharedobjects to store information on my server. I am not 100% sure how to do this, so I was looking up tutorials and came across this bit of code:
[Code]...
But when it gets to the 3rd line, it crashes. I don't know how to use the debugger for flex sadly enough
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
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
Sep 19, 2009
working a project that has 9 swf.a lot of the swf are using the same classes like papervison and tweenlite.is there a way to store classes like papervison in a share library?
View 1 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
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
Dec 13, 2011
what is best method to store multiple images (layers) , so user can read(load) again and continue work.
currently doing this - each layer is stored as png file. with one text file contain all layers name etc
create one big png file, put all data in it as tiles. read tiles while loading..
create some custom format.
ideally, i wanted to implement c. but i need some guidance about where to start from.my mind always tells me that, logically it should be simple as..
psudo code
layer 1 name, layer1 resolution
layer 1 png data (using png encoder for my bitmapData)[code]....
View 1 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
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 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
Jun 26, 2008
I've started to work with Actionscript 3.0 for a couple of weeks and I've just started my very first "top-to-bottom" AS3 project which I'll be delivering (a "demo") next Monday.However, some basic complications are arising and I just don't know what to do, this probably has been answered a lot of times but I can't seem to find a single blogpost/forum/website that addresses this issue in a way that I can understand instead of "copy/pasting" code.[code]Ok, when I press a button inside the NavBar class I want it to execute a function that tells the DocumentSetup generated MovieClip(contentLoader) to load in a different SWF based on the arguments passed on the Event.My questions are:
1 - How do I access a public function on a different class? Let's say I have my navFunction() placed on the DocumentSetup Class, do I need to create "another" instance of the DocumentSetup Class just to tell it to do something?
2 - Let's say you're able to explain to me how to solve the problem above.How can I reference a MovieClip generated by the DocumentClass through another Class? I need something to tell the contentLoader MovieClip to change contents, how do I communicate with it from another Class if the MovieClip was added to the DisplayList through code on the DocumentClass?
3 - How can I create a Variable which is identified throughout the website, let's say I have an XML file with all the text content that's going to fill in the content placeholder's. How do I make this XML data accessible from all classes instead of having to re-import the XML again and again?
My external classes all work 100% themselves but I cannot get them to communicate with each other, I keep getting compiler errors...A website in which you can't navigate to a different page is basically useless
View 14 Replies
Dec 2, 2009
In developing (and learning) some OOP gallery class structures, I seem to hit a snag with the non-blocking nature of AS3.[code]However, I need to get these into a grid, and I have a grid class written that takes an array input. So, ideally I would push the i and v instances into the array, and have the grid class loop through and put them in a neat little block. However, I can't access the width and height of the img and vid class instances. I tried getters, and am thinking of having to do some custom events but I'd rather not. Surely there's something I'm missing?The closest thing I got, but it still triggered late, was an Event.ADDED in the img class.
View 3 Replies
Jun 23, 2009
So this is probably an easy thing I don't know, I'm hoping. But when I publish my project and test it in a normal HTML, the swf can find some classes but not others for some reason?
How can I make sure all the classes get compiled into the Swf? I got the main timeline calling the first class (CalypsoPlayer); and it finds this class find -- which is under the same class path. But CalypsoPlayer can't find the class it needs, even though it's under the same class path as the class.
I've tested the project in Flash itself and it all works great without any errors so I'm not sure what's going on. It's only when I test the published SWF that it can't find all the classes it needs.
View 2 Replies
Mar 22, 2010
I have two custom as3 classes, TriviaGame and TriviaQuestion, and I am attempting to retrieve a bitmap image stored in TriviaQuestion and have found it impossible thus far.
It seems the root of my problem is that bitmap is somehow null in my GetImage() function, even though it is class data that has been set earlier in ImageLoaded(). The only time I am able to access the bitmap's info (in order to add it to the display) is inside ImageLoaded().
In TriviaQuestion.as, loading the image:
private function XMLLoadedHandler (e:Event):void
{
xml = new XML(e.target.data);
[Code].....
View 14 Replies
Jul 13, 2010
I have made a very simple custom class for keeping track of groups of offices for a company. The class has a Number variable to tell it how many different offices there are, and an Array to store the individual offices by name. It looks like this.
class officeCluster{
static var _className:String = "officeCluster";
// variables var numOffices:Number;
var locationArray:Array = new Array();
// functions function officeCluster() {
trace("officeCluster constructor");
}}
Now, it is my understand that when I create different instances of the class, they will each have their own version of "numOffices" and their own version of "locationArray". When I run traces of "numOffices", this seems to be true. For example,
trace(manufacturingOfficeCluster.numOffices);
trace(servicesOfficeCluster.numOffices);
yields
5
4
In the output panel, which is correct. However, there is trouble with the locationArray. It seems that as I assign different values to it, regardless of what instance I specify, there is only ONE array- NOT one for each instance. In other words,
trace(manufacturingOfficeCluster.locationArray[1].theLocation);
// theLocation is a String. The locationArray itself holds Objects.trace(servicesOfficeCluster.locationArray[1].theLocation);
Is anyone aware of any issues partaining to using Arrays within Class instances? I've been able to work around this by creating multiple arrays within the class and using a different one for each instance, but this seems very sloppy.
View 4 Replies
Jul 17, 2011
I'm using a electronic device to dispatch events within AS3.
short explanation: -->
Think of these events as a KeyboardEvent.My point is to dispatch an Event (like a Key that is being pressed) so I can listen to this event on EVERY Class I need to.I'm not sure how to instantiate or listen to these events correctly =/
I mean: I want to be able to listen to the key that is been pressed as if that was a global event every Class can receive...
long explanation: --> I'm doing something like this:
1) created a (main) Class that extends a Sprite.
2) created a class (KeyboardInput) that extends the main class.
3) created a class (KeyMap) that extends EventDispatcher.
4) created a class (HomeScreen) that extends a Sprite.
My FLA file is associated to the KeyboardInput Class.This Class creates a listener for the KEY_DOWN KeyboardEvent and instantiate the KeyMap Class that dispatches a CustomEvent:
stage.addEventListener(KeyboardEvent.KEY_DOWN,function(evt:KeyboardEve nt):void { keymap = new KeyMap(); keymap.setKey(String.fromCharCode(e.charCode)) });[code].....
View 3 Replies
Feb 5, 2010
I am trying to import classes to no avail.
[Code]...
View 1 Replies
Apr 1, 2012
Incorrect number of arguments. Expected no more than 0.hen I try to:ar countries:Country = new Country(10);ormally this would work in Java or C++, so I'm not sure what's up!?Here is my custom class.
package {
public class Country {
var cName:String = "noName";
[code].......
View 2 Replies
Feb 12, 2009
I was wondering if anyone knew how to create a .swc library file that could be used in Flash or Flex?I want to compile a custom package of classes into a .swc for use and download,
View 1 Replies