Actionscript :: Wildcard For Strings In E4X?

Jan 29, 2011

I'm trying to solve an Actionscript problem using E4X.I have an XML like this one:

<root>
<person firstname="john" lastname="doe" age="21" />
<person firstname="jayne" lastname="doe" age="35" />[code]....

I want to have just one function search() that takes three parameters (firstname, lastname, age) and return an XMLList. So the result could look like this:

var result:XMLList = xml..person.(@firstname == firstName && @lastname == lastName && @age == age );

But I don't want to use all three parameters all the time. I would like to have a function that uses a 'wilcard' if the parameter is NULL. So if the wildcard would be "*" the function could look like:

searchPerson( firstName:String ="*", lastName:String = "*" , age:String = "*") {...}

so that I would only pass 'John' for the firstName I'd get the first and the third node in return.

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Push Multiple Strings Into An Array, And Some Of The Strings Are The Same?

Aug 24, 2009

I work on AS3 one week, and then take a break for a few weeks, then work on it a day, take a break, etc.. So I forget some of the basics, and need refreshers. I think I need to stop taking breaks.

Problem: I push multiple strings into an array, and some of the strings are the same.

Code:
var myArray = new Array();
myArray.push (Snivvle);
myArray.push (Kirupa);
myArray.push (Snivvle);

I want to find out which element positions "Snivvle" hogs up. We can see that it would be using element 0 and 2, and if we do an "indexOf" we would only get to see element 0, and doing a "lastIndexOf" we would only see element 2. How do I find out ALL of the element positions "Snivvle" is located in, so that it returns: element 0, element 2.

View 2 Replies

AS3 :: Loading External Swf In Array Using Wildcard?

Sep 27, 2010

I can use the following code to load in a specific swf:
 
var clips:Array = ["001/001.swf"];
 
but how do I tell Flash to load whatever file is in the 001 folder without stipulating a specific filename?

View 1 Replies

ActionScript 3.0 :: Switch Case With Wildcard Possible?

May 27, 2011

I would like to use a switch statement i.e.

[Code].....

What I am trying to do is to say that the condition is if the name property has an A character in it and anything afterwards. Is this possible or am I nuts.

View 6 Replies

ActionScript 3.0 :: Importing Fl Classes And The Asterisks Wildcard?

Dec 30, 2009

I just had a weird issue occur. I had the following include statement:

Code:
import fl.transitions.*;
and when I tried to add a this Tween:

[code]....

View 3 Replies

ActionScript 3 :: Difference Between Wildcard And Object Datatypes?

Sep 20, 2010

When declaring a variable to have an open datatype, is there any difference, especially a performance difference, between typing a variable as a "wildcard" (I'm not sure of the official name for this) and typing a variable as an Object?
var myVar:*;
var myVar:Object;

View 2 Replies

ActionScript 3.0 :: URL Wildcard Path Linking - File In Folder

Jan 1, 2011

I have one file in a folder. I want to access that file but all I know is the extension. How would I link that file? At the moment, I have:
new URLRequest("music/*.mp3")

I have also tried various others such as:
new URLRequest("music/'*'.mp3")
new URLRequest("music/*.*")

When I put the actual link in such as:
new URLRequest("music/song.mp3")
It works perfectly fine, though.

View 2 Replies

ActionScript 3.0 :: Sandbox Violation While Using Wildcard Inclusions In Crossdomain.xml?

Dec 3, 2009

Here is my crossdomain.xml:

HTML Code:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>

[code]....

View 1 Replies

ActionScript 3.0 :: Listing Each Class In Imports Separately Instead Of Using A Wildcard?

Feb 9, 2012

I just wondered, what is the benefit of listing each class in imports separately instead of using a wildcard?[code]Is there any benefit at all?

View 3 Replies

Flex :: Compiling Content Of Directories / Wildcard To SWC Using Compc Ant Tasks

Jul 29, 2010

Here is how I usually write the compile task:

[Code]...

What I'm looking for is a way to compile the entire director of classes without having to specify each class. I'm sure there's already an option for that, but I couldn't figure out the exact syntax.

View 1 Replies

ActionScript 2.0 :: CS3 Adition Of Two Strings?

Mar 11, 2010

i know, that i have to CAST them... but how?add (adition) two strings...

a:String = "20";
b:String = "10";
c:String = a+b;

I get c=2010 and not 30 as i expected...i guess i have to cast, but how?

View 1 Replies

Formatting Strings For Time?

Mar 30, 2010

how to format strings better and pad for leading zeros.here's the code:

var dt, timeint;
dt = new Date();
var TimeText:String;[code]...............

View 6 Replies

ActionScript 2.0 :: [FMX] Loading TXT And Strings?

Jun 26, 2003

i have a .txt full of words (strings) devided by lines and separated with ; and i want to be able to load 1 random line and the first string of it..xALI;DALI;IDEAL;DELIRAREDIAL;REPELIDAAMO;MATO;MORTA;MOSTRA;MAESTRO;BATERMOSi want to be able to load "ALI" for example. and then load DALI etc etci used loadvariablesnum to load the text, but maybe that shouldn't be the best option..

View 7 Replies

ActionScript 2.0 :: Encoding Strings For PHP/SQL?

Jun 3, 2002

which characters need to be encoded for PHP and SQL, and how to do it?

View 2 Replies

IDE :: Converting Numbers Into Strings?

May 26, 2009

I'm doing the finishing touches on my games. I want to keep track of and display the level (waveCount) and display it in a dynamic text box. However, AS isn't allowing me to convert the number into a string.

[Code]...

View 1 Replies

ActionScript 2.0 :: Addition Of Two Strings?

Mar 11, 2010

Here we go... i know, that i have to CAST them... but how? The idea is to add (adition) two strings...

a:String = "20";
b:String = "10";
c:String = a+b;

I get c=2010 and not 30 as i expected... i guess i have to cast, but how?

View 1 Replies

ActionScript 2.0 :: 2 Strings In Textfield?

Apr 15, 2005

I have a texfield in which I would like to display to strings. Right now, I can only use one of the strings by doing:myTextfield.text = str1

View 3 Replies

ActionScript 3.0 :: Converting Numbers Into Strings?

May 26, 2009

I want to keep track of and display the level (waveCount) and display it in a dynamic text box. However, AS isn't allowing me to convert the number into a string.

PHP Code:

private var waveCount:Number = new Number();
private var waveOutput:String = new String (waveCount);
private var waveWord:Sprite = new WaveWord();

[code]....

View 5 Replies

ActionScript 2.0 :: F8 Comparing To Multiple Strings

Jul 5, 2009

I would like to compare a string variable to multiple strings. Is it possible?I wrote a pseudo code of my own which doesn't cause an bug/error report,but it doesn't seem to work properly either:[code]

View 3 Replies

ActionScript 2.0 :: Checking Two Strings Against Each Other For Errors?

Dec 2, 2009

I'm making a typing game that focuses on developing typing speed and accuracy. In part of this game, the user has to type a given word in a certain amount of time. If the user types the whole word within the time limit, the timer stops and it results in 100% accuracy for that word. However, if the user does not type the word within the time limit, I want to compare the typed word to the given word and find out how many errors they made.

I found this to be a lot more complicated that I had expected it to be. Fore example, if a letter was accidentally skipped or an extra letter was added, it will make all following characters seem wrong, even though the user only made one mistake.

How do I go about comparing the two strings?

View 3 Replies

ActionScript 3.0 :: Creating Filepath Out Of Strings?

Dec 27, 2010

If I remove the variables and just type in the path name, the file does play. So there's no other error in this piece of code. I just can't seem to figure out how to create that filename from variables.

EDIT: I should point out more clearly its about the line = public var soundRequest:URLRequest = new URLRequest("sounds/" + Champ + soundType + ".mp3");

I get a 2044 unhandled ioerrorevent error and a 2032 stream error.

[code]....

View 9 Replies

ActionScript 3.0 :: Any Way To Identify Variable By Name Using Strings?

Apr 6, 2009

I have the following:
function ShowSlide(event:TweenEvent) {
m= getChildByName("tag"+slideIndex+"_mc");
m.visible = false;
if (slideIndex < 4) {
slideIndex++;
[Code] ....

And I want to do for "tagInitW" the same thing I do for "m" being given that I already have "created tag1InitW", "tag1InitH", "tag2InitW", "tag2InitH..." So is there anyway I can dynamically target a variable? This was easy in AS2, but because of the strict dataType the vars have in AS3, I can't do it like I was doing it in AS2.

View 4 Replies

ActionScript 1/2 :: New Line Into Text Strings?

Dec 29, 2009

I am building a textField object that will contain new line character." " does not appear to work. All that it has been doing is trunctate the text string to the first occurance of the " ". Does Action Script use Unix new lines; (line feed)? Javascript does, as well as other scripting languages I have been using, regardless of the platform. It needs to occur within double quotes; " rather than ' ', other wise it is rendered literally. How do I enter new lines into Action Script text strings?

View 3 Replies

Professional :: Locale Strings  In Buttons?

Nov 14, 2010

im trying to apply a language using AS3,all other textfields are changed except the buttons. Is it becuz the buttons have more than 1 frame?

View 1 Replies

Professional :: Sending Two Strings At Same Time

Nov 14, 2010

I am programing a flash page but writing function to send two stings at the same time? In my case, I would send backwardH and backwardLI have has tested all three options, but there is no error but either backwardH or backwardL movieclipet gets affected, not both at the same time though I would like both to be influenced at the same time. For example if I click button_1 then movieclip_1 and movieclip_2 would play. And if I click button_2 then just movieclip_1 would play.

//Option1
family.margeAS3.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_3);
function fl_MouseClickHandler_3(event:MouseEvent):void{
direct = "backwardH", "backwardL" ;margePa.play();}

//Option2
family.margeAS3.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_3);
function fl_MouseClickHandler_3(event:MouseEvent):void{
direct = "backwardH" + "backwardL";
margePa.play();}

//Option3
family.margeAS3.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_3);
function fl_MouseClickHandler_3(event:MouseEvent):void{direct = "backwardH";
direct = "backwardL" ;margePa.play();}

Swf file 1,2mb : [URL]
Fla file 3,5 mb (messy) : [URL]

View 7 Replies

ActionScript 3.0 :: Convert Number Like 1,2 Into 01 And 02 Strings?

Jan 6, 2012

Can we convert numbers[ints] like 1,2 into 01 and 02 strings, i need to set these numbers as a text to a TextField.

View 2 Replies

Flex :: Cut The Strings Longer Than N Characters?

May 6, 2010

what's the easiest way to cut string in Flex ?I mean, I have a sequence of urls, I want them at most 60 characters length. If they are longer they should be cut and "..." should be added at the end.

<mx:LinkButton label="{bookmarksRepeater.currentItem.name}" click="navigateToURL(new URLRequest(event.currentTarget.label.toString()))" />

View 2 Replies

Actionscript 3 :: Add Strings To Embedded Images?

May 12, 2011

Say I have something like this:

[Embed(source='../lib/images/image01.png')] var Image:Class


But I want to change that images based on another string like so:`

[code]...

But this gives me an error, is there another way to do something like this?

View 1 Replies

Flex :: Set Conditional Locale Strings

Oct 21, 2011

I'm trying to localize my Flex app, I have been able to setup the locale specifics and all the stuff inside MXML tags, that works pretty well, my question is, what about if I have for example:

[Code]....

How can I change with ActionScript those two strings to an other locale?

View 1 Replies

Actionscript 3 :: Finding A Sub-string That's In Between Two Other Sub Strings

Jan 14, 2012

I'm creating a flash application, which loads a file from a server, and stores it in a string. I'm wanting to find the substring within that string, which is inbetween two known substrings.

Note. I don't want to do this with reg-ex as i'd like it to be easily reusable.

Ideally I'd like a function which i can re-use, by passing the beginning and ending substrings.

e.g. something along these lines..

function getSubString(start:String, end:String):String


Edit: There may be more than one instance of the 'start' and 'end' substrings within the string, i'm wanting it between the first instance of each.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved