ActionScript 3.0 :: Reading Class Name As String
Jun 1, 2010does anyone know how do i make a string as a classname.[code]
View 11 Repliesdoes anyone know how do i make a string as a classname.[code]
View 11 RepliesI am doing an Actionscript 3.0 project which involves introspection. I am wondering if there is a way to get all the classes within a given package structure.
[Code]....
i have a php script that print with echo this: '&string="tom,dick,harry"' and i need to put the "tom,dick,harry" in an actionscript string, that i have to split in an array. I'm having problems reading the php output, i'm using the URLLoader and TheURLVariables Classes in this way
[Code]...
I currently have an array that looks like this:
ActionScript Code:
var array:Array=new Array["p", "e", "t"];
What I want to do is use an if statement to make it something like this:
ActionScript Code:
if (array.something=="pet") {
Notice the 'something' after array. I'm not sure if there is a way to take the data from an array and compare it to a string.
How do I read a string from a txt file and extract variables from it?[code]
View 3 RepliesI have Flash in my top frame and HTML in my bottom frame. I need an ActionScript that can read the URL of the bottom frame into a string. Then I need to replace a specific phrase in the middle of that string with a new phrase.
View 5 RepliesI'm trying to serialize and deserialize a byte array to a string using Base64 for as3.
Here is my code
public function Serialize(vector:Vector.<Action>):String
{
var bytes:ByteArray = new ByteArray();
var serialized:String = "";
[Code].....
is the error I get after calling deserializedObj = deserialized.readObject(); Should I be get that error if I'm just trying to put this into an object? I'm not trying to put it into an action class object yet, but if it is then the action it's getting doesn't have parameters that were originally inside.
I have the input textfield with instance name vIn, and the variable _vIn. (The textfield is empty.)[code]i have five other variable/textfield pairs were this works ok. I don't get why this pair doesn't work also, my textfields won't accept the subtraction operator, - , even though they're all set to vIn.restrict = "0123456789.-";It doesn't even work in the output textfields were there's no restriction (Negative results are displayed positive)
View 3 RepliesI'm building a class with AS3 which is supposed to be able to read via php an xml file of the which I specify the url and assign the return to a variable, the as3 cose is the following:
package
{
public class phpInterfaceClass
{
[Code]....
I know that I should make the readXML function return only after the loading event has completed, but I don't know how!
I have already set a variable in my document class "Main.as". I am now trying to access that variable and read its value from a different Class and Function, take that value and email it. For example in my "Main.as" file I have this function:
public var _myVar:String;
function create() {
_myVar = "hello";
}
Now from my other class "EmailtoFriend.as" I have a new function to try and get the value of that pre set variable:
function getVar() {
trace(_myVar);
}
Why will it not output "hello"? Instead I get an error saying: Access of undefined property _myVar.
Ok, I've written a simple class with some string/number variables and set/get functions (tested by creating static objects).
ActionScript Code:
import EventClass;
var aEvent = new EventClass();
[code].....
how do convert the myString var which is a string to the class name?
var myString:String = "movieClipInTheLibraryClassName"
var t:myString = myString()
I am changing the flashvars variables v1=value&v2=value ect then after the flash movie runs I am changing the variables externally by javascript, so far so good.when flash first loads it reads the vars correctly.when I try to read them ( after the change ) it keeps reading the old values.[code]everything works except I cannot seem to read the changed FlashVars.
View 1 RepliesHow do I create a class that extends the String class?
Lets say I've created an 'exString' class that extends String.
In my project file I do the following
Code:
var test:exString = new exString();
test = "Hello World";
text.someExStringFunction();
I get a type mismatch in my "Hello World" assignment because Flash sees it as a String and not as an exString.
I have three classes with names like
-enemy1
-enemy2
-enemy3
and an array enemyIndices = [1,1,2,2,3,1,2] or something like that. Is there any way to compose the class names on the fly so that I can write something like [code]
Is it possible to have a string "ClassA" and use it in order to instantiate a real ClassA in my application?
View 4 RepliesI have 52 symbols in my library each with class names Symbol1, Symbol2, Symbol3, etc. I want to create an array of these classes which will be used to create a random particle effect. How do I cast the var cardNumbers so that the array looks like this[code]...
View 1 RepliesI am trying to write a class that will take a string (provided by a different class) and display it gradually, character by character, as if it were being written by a typewriter. To do this I am making use of the setInterval method in flash.utils, but I'm having difficulties... whenever I test the movie there is no text displayed, but flash isn't reporting any errors. Here is the code:
[Code]...
Is it possible to use a class name stored in a string and pass it as a parameter??I'm using the push method in a flex mobile project. I have the name of the view I would like to pass into the push method stored in a string. But the push method only accepts it as a class not a string.How do I use a String to load or pass the class name to the method?
var NameClass:Class = "views.Contact";
navigator.pushView(NameClass);
I'd like to write a class that extends String, changing the functionality of several methods such as charAt to incorporate the Welsh alphabet. The reason for this is that the Welsh alphabet is as follows: as you can see, some "letters" actually contain two characters, which messes up any charAt operations, etc.
Is it possible to extend String? When I try, I get "base class is final".
I found this thread on another forum which talks about doing this, but has no mention of it not being extendible:[URL]..
I have a question about return..example:
Code: var date: Date = new Date(); trace (date)//Thu Oct 8 23:05:51 GMT-0300 2009 How i can get a String return by a Class? The default return with a normal Class is ([object Date])... Constructor can`t return values... how i can make that? :p
I need to call the mc from the library, dynamically any some of the mc's from library. I named that class as "mc_1", "mc_2", "mc_3" etc. I now have the class name as a String. With that I can't able to get the mc from the library.[code]...
View 1 RepliesHere is what I want to do...extend the String class Code: class example extends String {} and then I want to take things that are already strings and add a function to them which goes through and removes & and turns it back to & am things got some test code for that here
[Code]...
I just want to ask if is it possible to call a movieclip using the String Class together with it's instance name to use gotoAndPlay() method.
I know how to use the instance name and the method but then what if I want to use a string together with the instance name and the gotoAndPlay.
I asked yesterday how to call a function from an XML file, and I figured out how to make that work using the string-to-function call.so in my XML file I have <ITEM CALLBACK="ContactsList">View All</ITEM>, and my TextMenu class parses the XML file and creates my navigatable text menu instance. When enterMenu():String is called, it looks to see if the CALLBACK attribute has a value, and if so it returns it as a String.so..
var callbackFnc:String = textMenu.enterMenu();
if(callbackFnc != null)
{
[code].....
I want a way to pass a string statement from one base class to an other. The two classes are CLICK and READ.What's an easy way to do this? I haven't worked in classes that often to know some of the simple tricks.
[Code]...
[code]causes this error with mtasc compiler:type error String has no field myFunction it must be possible to add new functions to a class via prototype.is there any configuration i can do for mtasc to be able to compile this code?
View 1 RepliesIs it possible to create an object from a class with a dynamic name? I have the name of the class in a string, but I want to create an instance of that class.
View 2 RepliesIs there anyway to include a function or overrite something in a class that'll output a custom string when the object is called as a string?
So for example if I created a class named "myClass" and I instantiated it:
Code:
var myObject : myClass = new myClass();
When I:
Code:
TextControl.text = "blah blah, " + myObject;
myObject is getting casted as a string. Normally it would output:
"blah blah, [object myClass]"
Is there a built-in function that recast the object as string? Is there anyway for me to change that string output? I know I can just make a public toString() method in the class or something, but just wondering if there was something better.
I just want to ask if is it possible to call a movieclip using the String Class together with it's instance name to use gotoAndPlay() method.I know how to use the instance name and the method but then what if I want to use a string together with the instance name and the gotoAndPlay.
View 2 Replies