ActionScript 2.0 :: Make Code From A String?
Sep 2, 2004
i think u can do it via XML and the CustomFunctions methods in flash... but id rather do it all in flash if possible. what i want to do is to treat a string as a line of code.
Code:
actV="trace('Red')"
someButton.onPress=function(){
actV.toCode()
}
View 3 Replies
Similar Posts:
Sep 2, 2004
i think u can do it via XML and the CustomFunctions methods in flash... but id rather do it all in flash if possible.what i want to do is to treat a string as a line of code. eg.
Code:
actV="trace('Red')"
someButton.onPress=function(){
[code].....
View 3 Replies
May 11, 2009
I am making a pretty basic flash game using AS3, its a 'fill in the blank' type. I think I basically have this code figured out, but I think I need a string variable for the 'word' part, but I've never coded that before, so I was looking for some guidance on that topic. Here is the code I have right now[code]...
View 3 Replies
Mar 20, 2012
I have a for loop generating a string that needed to be executed as code.
var new_content_string:String = content_string.slice( 0, -1 ); // After generating my string, I slice the last letter.content_txt.htmlText = HERE // Here is the place I want to execute my string
View 8 Replies
Mar 29, 2011
is there a way to execute code that is stored in a string?(i guess the operation would look something like this)
var myCode:String = "{trace('Hello');trace('World')}";
var myFunction = myCode as Function;
myFunction();
[code].....
View 4 Replies
Nov 22, 2005
I need to evalueate a string as code... let me show you an example...Lets say, that I have a string:
Code:
string = "Math.cos(var1)*Math.sin(var2)";
And what I need to do, it to use its contents as code and not string like here:
Code:
var3 = Math.cos(var1)*Math.sin(var2);
View 3 Replies
Apr 24, 2009
Basically, I would like to expose the interface of some Flash code via a textField. I can easily tokenize the string and get the method name and use eval to call the method. I am having trouble collecting the parameters and handing them to the method.[code]...
View 1 Replies
Jul 8, 2009
Since Action Script is an interpreted language, and it is clear by decompiling animations that the code is still in there, is there any function that lists the code of a function or class as a string?asically, I want to create a suite of components for developers that lets them make modifications to or at least view the code behind a component while the animation is running, and that way make it easier to find bugs, instead of having to stop the animation, dig up the code for that class, and recompile it. It would be even handier if it was possible to edit code while the code was running, so the next time Flash encounters that code, it will instead run the new code. Yes, if used unwisely, that could cause a lot of problems, but the benefit outweighs the risk, and that feature is used in such development environments such as Visual Studio.
Likely, the only solution to that would be to give each class a "code" variable, likely a String. Then when the users click the button to view that certain source, it checks for the "code" variable and displays the contents. The problem is that you have to remember to update the variable each and every time Perhaps I can write an extension for FlashDevelop that does that automatically? It could just update that variable at compile time.
View 2 Replies
Nov 14, 2009
I'm trying to create a series of scripts that will create some custom event listeners. I have three movie clips on my stage. One is a movieclip who's sole function is to hold array's and the event listeners. A second which moves around the screen. And a third that is motionless.
The problem is that the argument I want to test (which activates the custom event) is held within a string.
What I want to know is, how do you test to see if the string argument is true?
Is it something similar to this:
[Code]...
I think I'm going about this in the wrong manner, however this is the only way I can think of this working (since I need to be able to dynamically create these events)
View 10 Replies
Dec 19, 2009
i've read a tutorial about passing variables to HTML. But this tutorial isnt clear for me.. [URL] EXAMPLE 1 Using Query String to Maximize Code Reuse I really dont have an idea what to do inside flash, bec the author only said: Quote: Assuming the image filename is image1.jpg, located at a folder named images. And assuming that the Flash movie will use a variable named imageFilename to refer to the file, then we can do this
How do I do that? Like having a empty movie clip and giving an instance name of imageFilename?
View 7 Replies
Nov 18, 2009
Say I recorded and imported sound files of my voice saying "Two", "Four", "Equals", and "Plus"Would it be possible to have Flash on click string together those sound files like a string so that the user would hear:
View 1 Replies
Sep 9, 2011
I have converted Actionscript to Javascript. There are 5 functions with the same code.Everything must become a string in order to replace the code from the function1().
function2() { function1.toString().slice(function1.toString().indexOf("if"), function1.toString().lastIndexOf("}")).split("[0]").join("[1]");
}
In Actioncript, we can use this[my_string] to convert string back to byteArray or something like that Javascript must surely have a method to convert string back to code right.
View 4 Replies
Aug 27, 2009
I have swf that loads xml from a folder. I want to copy that XML string and hard code it into flash as an entire string. Then dim my xml object equal to that string. Is this possible? Reasoning is because I don't want people duplicating the swf and chaning the xml to create a whole new object. I don't want to have to manualy enter each question and answer and value into the arrays. That's to time consuming.
AS2 code to load the XML:
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = "<myxml>My XML STRING HARD CODED HERE?</myxml>";
var questionXML:Array = new Array();
function loadXML(loaded) {
[Code] .....
View 1 Replies
Aug 19, 2010
Can any one tell me the how do we come to know when the code is written for number its taking as a string.
View 3 Replies
Dec 19, 2009
[URL]Using Query String to Maximize Code Reuse Assuming the image filename is image1.jpg, located at a folder named images. And assuming that the Flash movie will use a variable named imageFilename to refer to the file, then we can do this How do I do that? Like having a empty movie clip and giving an instance name of imageFilename?
View 1 Replies
May 31, 2011
give me the Regular Expression that can check if a given string has any HTML code in it, and coming to think of it I would be bothered with <a href="something">something</a> exactly.
View 2 Replies
Apr 12, 2011
i'd like to do something like this:
[Code]...
of course i could hardcode that - but if I then change something about the as file, the linenumbers won't be correct anymore, or maybe i rename the as file and so on. It'd be great to be able to create that string somehow using compiler directives. Is this Possible in an AIR application created with ActionScript 3.0?
View 1 Replies
Mar 16, 2010
I am trying to find out how to make one .as file code interact with another .as file's code.like, if I had one .as file that specified options of movies and then when the user clicks on a movie (loaded through xml) it uses code from another .as file to load the correct movie.
View 5 Replies
Jul 22, 2010
trying to make something in Flash and i need a var String to = a quotation mark... but i don't know how to do it...
eg: var whatEver:String = """ obviously that doesn't work... coz it just changes all the following coding to text...I tried searching Google and couldn't find anyone with the same problem.
View 3 Replies
Apr 6, 2010
The scenario is as follows:
I have a movieClip on the stage called "home_btn" and another called "home".
When moving over the home_btn movieClip I want the timeline inside of home to play. I used the slice command to get rid of the _btn which works fine, which is proven by the trace command, but it doesn't seem to be able to enter the timeline of home.
home_btn.addEventListener(MouseEvent.MOUSE_OVER, onOver);
function onOver(event:MouseEvent)
{
var selectedButton:Object;
[Code]....
View 1 Replies
Jul 28, 2010
I have a map of states state when a particular state is clicked on, the fla centers on and zooms to that state. When you click on a state a unique ID is pulled from an xml. Using this ID, I can then call all the counties that are part of this state through the county's xml which is also loaded on my stage.or example if I click on Arizona, it zooms and I get a trace of all the instance names of the counties within Arizona.
//call all instance names of Arizona counties
cldcnfips=(cntXml.Records.Record.(STATE_FIPS==cldstfips).afips.children());
trace(cldcnfips);
[code]......
View 7 Replies
Sep 11, 2009
i'm trying to make this html code into Transparent?
[Code]...
View 1 Replies
Nov 16, 2009
do u have any idea to create keyframe througy code ?
View 1 Replies
May 18, 2010
package {
import flash.display.Sprite;
import flash.events.*;
import flash.net.FileReference;
import flash.net.FileReferenceList;
public class FileReferenceListExample extends Sprite {
[Code] .....
Code like the above will get executed as soon as loaded, how can I make it run under certain condition? Pretty much this in this answer:
function keyEvent(code:String):void {
// do something with the "code" parameter,
that looks like "alt+ctrl+D", may use .split('+'), etc
}
View 1 Replies
Jun 21, 2010
i have many actionscript classes. i will give the codes to some other programmer but i don't want to let him to see all of the code. how can i make code unreadable but make project run? is creating swc or library make this?
View 9 Replies
Sep 2, 2010
I've build a simple twitter feed flash application that uses php script to read the latest tweet from xml and returns the string to flash to be displayed in a text box. However, I was wondering if there is some easy way to make the url in the tweet an active link? [URL]
View 5 Replies
Apr 12, 2011
Maybe nonsence but is there a way to make some Class instance when owning only its String name?
I mean,
function makeClassInstance(className:String):void{
var instance: Class(className) = new Class(className);
}
That's all about valueObjects. I wish to retrieve classNames from values setted up in main app for universality.
View 9 Replies
Jan 25, 2012
I've created some variables. I've created a string using those variables. I want to display the value of that string in a text box.
ActionScript Code:
var today_date:Date = new Date();
var thismonth:uint = today_date.getMonth();
var mnth:Array = new
[Code].....
View 3 Replies
Apr 19, 2010
Trying to recognize urls from an xml text (as1) I have not access to edit the xml.The url is loaded as string, ex: "lorem ipsum dolor sThe url is not always at the end of the stringI'm loading it and showing as htmlText, but the url is not likeable (coz have no tags T.T )using split and join i got:
Code:
function sar(holder, searchfor, replacement) {
tarray = holder.split(searchfor);
[code].....
View 6 Replies
Feb 16, 2009
for (var i = 0 ; i < 10000000; i++) ;stop();I've placed this code in frame 1 of a flash app. As you can see it does nothing but count to 10,000,000. This takes about 20 seconds to execute.
In C#.NET, this one line runs over 400 times faster. It can count to one billion in less time. Why? I could see it being faster in C#, but what could possibly be going on under the hood that could make it 400 times slower in AS, given that the one line should reduce to just a few machine instructions?
(If you're wondering, I've been tasked with porting some C# code to ActionScript. The code has some scientific calculations in it. But in AS they run so slow that it is unusable. This is the most basic example of the problem.)
View 14 Replies