ActionScript 2.0 :: Delete An IF Expression?
May 30, 2004Is it possible to delete an IF expression? Like when you delete an onEnterFrame ?
View 4 RepliesIs it possible to delete an IF expression? Like when you delete an onEnterFrame ?
View 4 RepliesIs it posible to delete an IF expression? Like when you delete an onEnterFrame ?
View 4 RepliesI got these four errors when I tried to create a button on the stage that would delete the text I inputted in the inputtext(ti). Based on the scripts I have and the errors, what should I write to create the delete button?
[Code]....
I am implementing a flex auto-suggest combobox - as the user types in each character: Consider the string 'Stackoverflow' and user input = 'st'
1) the data provider is filtered to show all items starting with 'st'
2) text is set to auto-suggest string such that the un-typed part is highlighted.
So for instance, the combobox text may contain st'ackoverflow', where 'ackoverflow' is highlighted using setSelectedIndex()When I hit back-space or delete, and check the 'this.text' value, I expect that the last un-highlighted character ('t' in the above case) gets deleted and the data provider is filtered to show all items starting with 's'. However the text property contains 'st', as before
i have ade moultiple textbox at run time now i want to delete a textbox by delete key how it is possible .
View 4 RepliesI'm trying to use the delete keyword to remove nodes from an xml file and it just plain won't work.Here's a stripped down example of what I'm working with. Every node has a child named "deleteme". If its value is equal to 1 I want to remove it from the xml file. If its anything else I want to leave it be. The delete method is deffinately gettig call but it's having no effect.
<?xml version="1.0" encoding="utf-8"?>
<stuff>
<i>
[code]......
i have A,B,C,D moveiclip
now i want to delete a mc with delete key .if i select A then press delete key it will delete .
Possible Duplicate:In Flash, how would I run an e4x statement when that statement is stored in a String?I know there is an existing question regarding this problem, but it got no replies.Ideally, I would like to stick an e4x expression in a string and run it.
var tempXML:XML = someXML;
var stringe4x:XML = "pictures.picture.(size > 200)";
tempXML.eval(pictures); //something instead of eval
Since AS3 doesn't have eval, this doesn't work; however, there is the ability to use elements() and attributes() to get the elements or attributes on the same XML node level, but this doesn't work for the more complicated e4x filters such as "(id > 300)" or ".." notation.
I need to extract the name of the video from the below xml. find the e4x expression for this?
[Code]...
I'm new to these forums and to actionscript as well, so please excuse my lack of clarity when explaining this situation, I'm learning on my own and in my free time!This isn't really a problem in the sense that I've found a workaround to it, but it's bugging me that I don't understand what's going on in this situation. In the last couple of weeks I have been working on a gridless pathfinding solution for a point & click game, I finally got it done, but I was stuck at some point for a few days and I discovered that there was an x property of a point I was referencing that kept changing back to a previous value assigned to it. I don't know if I'm making any sense, but so you guys see what I'm talking about:
[Code]...
First a fabric button sets:
_root.fabricbuttonselected="_root.fabric01";
then the color button sets:
_root.selectedcolor=_root.fabricbuttonselected + "_chip10_name";
This returns the name of a variable:
"_root.fabric01_chip10_name"
however I have preset the variable to "Rose"
_root.fabric01_chip10_name = "Rose";
My dynamic text box is set to:
_root.selectedcolor
but instead of displaying "Rose" it displays"_root.fabric01_chip10_name" Basically I need to get the literal value to equal an expression- how do I do this?
I am scripting a button and something like this: _root.READ = ("image6"); takes me exactly where I want, the frame labeled "image6" However i want to reuse this button and I want to switch it to something like: _root.READ = (trace(this._name)); where it calls upon the instance name (image6). However, this doesn't work, and I believe it's because there are no quotes around the word. Is there someway I can output what the trace calls and put it in quotes?
View 2 RepliesI need to convert a string such as "x*y+2" (from an input text field) into an expression x*y+2, so that it can be evaluated normally, eg f=x*y+2. The variables x and y are already defined and can have various values; I need to evaluate the strings as expressions.
I have tried f=Number("x*y+2") but it seems to work only when the string is actually a number such as "1.2e-4".
So why can I evaluate an expression in a switch like so:
[Code]...
If I trace vidList[currentIndex].video before the switch I get "city" but tracing vid after the switch I get null Quickly solved by just assigning to a variable and then using that in the switch... but it still seems odd I can't just do it directly.
[Code]...
I've written a url validator for a project I am working on. For my requirements it works great, except when the last part for the url goes longer than 22 characters it breaks. My expression:/((https?)://)([^s.]+.)+([^s.]+)(:d+/S+)/i
It expects input that looks like "http(s)://hostname:port/location". When I give it the input: https://demo10:443/111112222233333444445
it works, but if I pass the input https://demo10:443/1111122222333334444455
it breaks. You can test it out easily at[URL].. Oddly, I can't reproduce the problem with just the relevant (I would think) part /(:d+/S+)/i. I can have as many characters after the required / and it works great. Any ideas or known bugs?
[Code]...
I'm having a problem with an expression in my sql statement in SQLite for Adobe AIR basically I have this sql = "UPDATE uniforms SET status=@status WHERE customerId IN(19,20)"; updateStmt.parameters["@status"] = args[1]; updateStmt.execute();
if I run the above code it works, updating the status when the id are 19 and 20
but if I pass the ids list as a parameter like this
sql = "UPDATE uniforms SET status=@status WHERE customerId IN(@ids)";
updateStmt.parameters["@status"] = args[1];
updateStmt.parameters["@ids"] = "19,20";
updateStmt.execute();
it gives me and error, saying could not convert text value to numeric value, which make sense because I'm passing and string but the IN expression should convert it accordingly, like it does when I pass directly the list values, why is not working the other way,
I need to evaluate an expression in a string at run time . Not sure how to achieve this in Flex. My requirement is as follows
var test:String = "myparams.id=10" ;
//test will be a string populated at runtime.
// I need to treat it as an expression and evaluate it at runtime
[Code]....
is it possible to do something like this action script 3?
I believe the eval function earlier allowed this, but now it has been depreciated?
I'm creating a chat app and I would like to if someone enters a url that it turn color and turn into a hyperlink. I am not sure how to write the regular expression. I guess the approach would be to check for "http://" or "www." or ".com" ?
View 0 RepliesI'm trying to create a replace method that allows me to surround parts of a string with tags. I tried this with a regular replace technique (join and split) but thats case sensitive. what i want is:
: "A nice example line"
and replace "Ice" in that line to surround it with bold tags, result:
text: "A n<b>ice</b> example line"
ActionScript Code:
var str:String = "A nice example line";
var pattern:RegExp = /(w+)-(w+)/gi;
trace(str.replace(pattern, "$2,$1"));
But i just can't figure out the replace pattern
I'm a complete novice to ActionScript, OOP and Flash. I have no idea when you are supposed to use the keyword "this". I have searched the forums but obviously searching for the word "this" is not very successful! I've read quite a few tutorials now and it seems that different people have different opinions on when and where it should be used. For example what should I be doing in the following class? Both seem to work but is one the "correct" way? Are there situations where things will not work if you omit the "this"?
ActionScript Code:
public class Sector {
private var _radius:Number;
public function Sector(radius:Number){
[B]this.[/B]_radius = radius;
} public function get radius():Number{
return this._radius;
} public function set radius(value:Number):void{
this._radius = value;
}}
I have another possibly related question with regards to naming conventions. I like the use of underscores for properties with getters and setters but what about the names of the constructor parameters that are used to initialise these properties? In the above example I have used "radius" for the constructor parameter although it is also used for the getter and setter functions. It seems a bit of a palaver to come up with different names for the same quantity but is what I have done really bad coding practice?
I have 3 extenal flv files that can be loaded into the main movie when pressing a button.I am using seek and cuePoints to provide a DVD 'chapter-type' navigation.The cue points (in seconds) for each flv are stored as separate arrayshen I click to load a flv, I want to change the array that is being used to seek the playhead.I thought I could do that by using a 'current movie' variable and use an expression to access the relevant array. The essential code (for brevity) is like this:
//
var flv1cuePoint:Array = new Array(10,30,50);
var flv2cuePoint:Array = new Array(30,50,60);
[code].......
Code:
var Happy:Array
Happy[Happy.length] = "_root.Train1_mc"
[code].....
I have a php file that has three variables that are passed to a flash file. I know the variables are going through, as I can display them via input text elements.
one of the variables is called percent I want a movie clip called 'thermo' to go to the frame number that the variable 'percent' has stored. For whatever reason, this is not working
_root
loadVariables("scripts/membership_drive.php", "");
_root.thermo code on frame #1
stop();
gotoAndStop(_root.percent);
Like maybe the script does not see the variable percent as a number?
I have a string "5^2". Is there a way to calculate the value of the expression stored in the string?
View 3 RepliesI have some text that is displaying from a database table and inside that text is a web address (i.e.,
[Code]...
I am trying to understand some basics of Regular Expressions.For just a experiment I wanted to count the total words in a string.var str:String = "hello, this is some text to count the word hello and to check if Hello is ignored by case and if hellow is different";[code]Here i get the array of the values. and using it's length I can use the total number. This works, but the regular expression is not dynamic.[code]
View 2 RepliesI have a string "52x + 60" and i want to extract 52x and 60 using regular expressions and a switch case
Is this the right way of doing it?
var equation:String = "32x + 5"
var numberExract:RegExp = /d+/
var xExtract:RegExp = /d+/x/
for(var i:Number=0; i<equation.length; i++)
[Code]...
I've got this regular expression for decimal points:
var decimalPattern:RegExp = /(d+)(.)(d+)/gi
var result:Object = decimalPattern.exec(equation)
var i:Number = 0
[Code]....
Why is my output when i trace the number array this
3.2
3.2,3,.,2
I have a string "4 + x + 5" and i want to change the x to 1x When using a regular expression for x i end up in an endless loop because when the x is changed to 1x, the regular expression finds the x in 1x and applies it to that Is there anyway of making is skip the next character? Here is my code:
[Code]...
I'm having a problem converting a regular expression from Python into Flex. My string is something like this:
SELECT "col", othercol,
othercol3" FROM doesn'tmatter...
Python matches just fine:
>>> re.search('select(.*?)from', 'SELECT "col", othercol,
[Code]..
match always ends up null. What am I doing wrong? I'm sure it's obvious to a seasoned Flex programmer...