Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Pass A String, Return Object With Name String



I feel like this should be pretty easy, but I 'm not quite sure how to do this...I've got a string that is the name of a movieclip which is on the stage. I'd like to write a function which I can pass that string and have it return the object which has the instance name of that string.Any hints?Thanks.John



KirupaForum > Flash > ActionScript 3.0
Posted on: 08-21-2008, 05:02 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

How Do I Pass Variables Into String Object?
Hi,

Im trying to count the number of characters in a string using the string object. I can do this OK when I count the number of chars in a form field but I need to count the number of chars in a variable. Someone told me to use the code "+test+" below to count the variable named 'test', but all this does is return "6". This seems to be just counting the string +test+ (i.e. 6 chars.) rather than a variable

on (release) {
test = "ThisShouldDisplay19";
result = "+test+".length;
}

Can anyone help?

Cheers...John

Save Object To String -> Load String And Convert Back To Object?
Wondering if anyone knows if this is possible. First a little explanation:

1. I have container grid where you can add and position MC's
2. The MC's x,y and other data is stored in a 3d object
3. The object is setup like this: matrix (object) -> levels (objects) -> profiles (objects). So basically a grid which mirrors what you see on screen.

This all works great; however, the application needs to have a save feature. My first thought was decode the matrix into an XML and save that.

Then I thought maybe you can just convert the matrix object to one big string and save that.

Questions: when the string is loaded back into the movie how do you (or can you even) covert it back in a object that flash can read?

Any help/input is greatly appreciated.

Can't Pass String To Nc.connect(string)
hey guys. fairly new to flash, but I've managed to throw together a player with info and tutorials from here and other places. I've got everything just how I want it save for one problem. I've got an XML file that I get the URL for my server from and also get the names of videos to populate a list. Here's the problem:
I can get the URL into a string in my program (it traces fine). However, when i try to pass that string in my nc.connect(string) it doesn't work. Everything loads fine, but when you click a video, it can't connect to it. If I manually enter the URL into the connect field like this: nc.connect("rtmp://url") it works fine.
So am I missing something? Why can it take the URL manually entered and not from a string?

What's The Best Way To Parse Out A Url String Using The String Object In Flash
I'm creating a CMS(Content Management System) tool so that users can change text and the changes be reflected in a text window in flash . The text that the user enters in the CMS tool will be stored in the database.

In flash I want to parse the string that I get from the database and look for URL strings that start with http "http://www.someurl.com" and parse out that substring.

For example the string could be "Please vist my site at http://www.site.com". I would want to parse out the http://www.site.com


If I find this url string I want to pre-pend the a href tag <a> and append the closing </a> tag to the string so that this link will be clickable from the textfield.

Does flash have an object that deals with Regular Expressions?
I've looked at the String object in flash but not sure how to achieve this task

I'm currently working on this so any ideas?

What's The Best Way To Parse Out A Url String Using The String Object In Flash
I'm creating a CMS(Content Management System) tool so that users can change text and the changes be reflected in a text window in flash . The text that the user enters in the CMS tool will be stored in the database.

In flash I want to parse the string that I get from the database and look for URL strings that start with http "http://www.someurl.com" and parse out that substring.

For example the string could be "Please vist my site at http://www.site.com". I would want to parse out the http://www.site.com


If I find this url string I want to pre-pend the a href tag <a> and append the closing </a> tag to the string so that this link will be clickable from the textfield.

Does flash have an object that deals with Regular Expressions?
I've looked at the String object in flash but not sure how to achieve this task

I'm currently working on this so any ideas?

Return In String
is there a way to write:

"The dog ran fast.

The dog ran slow."

using a string? What I mean is is there a way to skip a line between a given amount of text? Like a return key.

-thanks

Return String
Last edited by weewee : 2004-10-06 at 16:49.
























hello. i want to enter a certain word and make the programm return a word or string corresponding to that word entered. for example if i was to type "how are you?" the program would maybe search an array in the program and return "good" else it would return "invalid command". any tutorials? thanks.

Pass A String ?
Help!

I thought I knew how to do this, but don't...

I have a Flash 5 entrance page that I want to link to a Javascript page. But it gets better. The Javascript page is simply thumbnails.html (yes it's a portfolio site, no it's not mine).
The thumbnails.html page uses javascript to populate it's content based on a string that's passed in the URL. Example:
thumbnails.html?L -> will bring up landscapes. The problem is that Flash doesn't want to seem to pass the "?L" part of the string.

Is there a way around this? I have tried both as a text URL and as a button URL. I have also tried Window=_blank, nothing seems to work?
Please HELP!

Thanks!!!!

-Eric

How 2 Pass A Var String As The Name Of A Var?
Last edited by jeanrene : 2004-05-05 at 20:09.
























Here is what I'm trying to accomplish.

1) Get the number of days since April 30th, 2004 -- This works
2) Add leading zeros to end up with a "string" that is always 4 digit long (for e.g., 12 is converted to 0012) -- This works
3) I create a string variable to each day (poor man's database) for e.g. Txt0005 = "Text 5"; -- this works

HERE IS MY PROBLEM:
4) I'd like for TodayTxt var to load the string from Txt0005 above (changing to Txt0004, Txt0003, etc. as the counter changes). This mean that I'd like TodayTxt = "Text 5". However, I'm only geting TodayTxt to become "Txt0005" rather than it's content (Text 5".

Here is my AS. Any help would be greatly appreciated!

JR




ActionScript Code:
// Gets April 30th, 2004
DateZero = new Date(2004,3,30);
 
// Gets today's date
DateNow = new Date();
 
// Counts the number of days since April 30th, 2004
MaxCount = countDays(DateNow, DateZero);
Counter = MaxCount;
 
function countDays(DateNow, DateZero) {
    var difference = Math.floor( (DateNow - DateZero)/(86400000) );
    return difference;
}
 
function LeadingZeros(arg) {
    if (length(arg)==1) {
        arg = "000" + arg;
        return arg;
        }
    else {
        if (length(arg)==2) {
            arg = "00" + arg;
            return arg;
        }
        else {
            if(length(arg)==3) {
                arg = "0" + arg;
                return arg;
            }
            else {
                return arg;
                }
        }
    }
}
 
// Variable for each day
Txt0005 = "Text 5";
Txt0004 = "Text 4";
Txt0003 = "Text 3";
Txt0002 = "Text 2";
Txt0001 = "Text 1";
 
// The problem is certainly here
TodayTxt = String("Txt" + LeadingZeros(String(Counter)));

How To Pass .SWF String
Hi guys, after 6 hours searching on the web and trying the suggestions I found I am still empty handed.. so any help would be very appreciated!

What I want:

- i have a .swf file wich links to a .php file
- I want to add a variable to the link in the .swf file to pass to the .php file.

Like now it is


Code:

on (release) {
getUrl("video.php");
}



I want to have a variable added to that URL so it knows which video to play without having to make 100+ .swf files for each video.

I found this suggestion:

in the page where I've embedded the flash file I add the variable which I retreive with php echo to the .swf:


Code:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="437" height="153">
<param name="movie" value="video.swf?video=24">
<param name="quality" value="high">
<embed src="video.swf?video=24" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="437" height="153"></embed></object>




and added this to the on(release) command in the .fla file:


Code:

on (release) {
if (_root.video == 24) {
getURL("video.php?video=24");
}
}




Sadly, this does not work, although I have the feeling I am close... anyone with the correct way of coding this?

Thanks
stever

How Do I Get A Return In A Concatenated String?
How can I put a return in this so it displays on two lines in my dynamic text box?

myTextField = featureList.childNodes[0] + " " + featureList.childNodes[1]


Thanks

Send And Return String
Hi, I tried a quick search but FK is very slow from here at thes time of day.
What I have is a string, which I then send to a function which alters it.

eg
mystring = "how_now_brown_cow"

and my function pulls out the underscores so you get

"how now brown cow"

what I would like to do is actually update the mystring value, rather than assign a new string the updated value
I think you can do this kind of thing with return() but I am not having any luck

so to explain it a little more clearly

i have
mystring = "how_now_brown_cow"
RemoveUnderscores(mystring)

and what I would like now if i said
mytextcheck.text = mystring
is for it to read: "how now brown cow"

Thanks

Text String Return?
Can you insert a return (line break) in a text string that you are sending through action script?

Catbert hooked it up last time with my similar question on "'s and @&^$#$symbols in text strings, but I forgot to ask about returns. (wouldn't you know it wasn't a problem then)

Pass A String To A Button
I use a textfield on my webpage and i want to pass the string of that textfield to a button.

example :
I set in the textfield the words : click on this button
so on the button should appear click on this button.

Can anyone help me ?

Pass String Variable Into XML ULR
I am trying to pass a variable through "strSource:String" so that i can dynamically tell the player to load different videos depending upon which page it is on.

This works:

Code:
var strSource:String = root.loaderInfo.parameters.playlist == null ? "includes/video1.xml" : root.loaderInfo.parameters.playlist;

function initVideoPlayer():void {

// create a new net connection, add event listener and connect
// to null because we don't have a media server
ncConnection = new NetConnection();
ncConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
ncConnection.connect(null);

// create a new netstream with the net connection, add event
// listener, set client to this for handling meta data and
// set the buffer time to the value from the constant
nsStream = new NetStream(ncConnection);
nsStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
nsStream.client = this;
nsStream.bufferTime = BUFFER_TIME;

// attach net stream to video object on the stage
mcVideoControls.vidDisplay.attachNetStream(nsStream);
// set the smoothing value from the constant
mcVideoControls.vidDisplay.smoothing = SMOOTHING;

// create new request for loading the playlist xml, add an event listener
// and load it
urlRequest = new URLRequest(strSource);
urlLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE, playlistLoaded);
urlLoader.load(urlRequest);
}
Doesnt work if i try it like this:

Code:
var btnContent1:String = new String("includes/video1.xml");

var strSource:String = root.loaderInfo.parameters.playlist == null ? btnContent1 : root.loaderInfo.parameters.playlist;
Does anyone know why this is?

I can even put the URLRequest in as "includes/" + "video1" + ".xml" and it will work but as soon as i try to trade the "video1" for a string Variable it cannot find it.

My End hope to pass this variable through would be to have it on the HTML page where i could then dictate the exact path for the video XML

Code:
// source variables from HTML/js param
var btnContent1:String = root.loaderInfo.parameters["vOne"];
var btnContent2:String = root.loaderInfo.parameters["vTwo"];
var btnContent3:String = root.loaderInfo.parameters["vThree"];

Thanks for any help

will

Swf Pass String To Script
Hi,
I have a php page with embeded flash object, and within the flash object I have a text field and a search button. I need to pass the user input string from the text field to this script (when I press the search button):
<FORM name=formsearch method=GET action="http://www.deutschesfachbuch.de/info/news.php">
<input name="_enc" type="hidden" value="sends">
... and hopefully have the result in the same browser window

How do I do that with AS 2.0

BR,
Nixx

Pass A Function As A String
Hello all,

I'm messing around trying to plug Robert Penner's easing equations into a tweenEngine class which imports com.robertpenner.easing.*. When a tween is called, I want to be able to pass the type of ease through as an argument.

If I pass it through as a function, it comes through as undefined (because there is no Cubic.easeOut in the class I'm calling it from I assume), so I'm trying to pass it through as a String then convert it to a function.

Is this possible? If not, How should I deal with it?

Many thanks

Pass Text To String On ^*.txt
Im searching on livedocs but nothing found about this.
I want to get text writen on a txt file and store it in a variable type string so the work should be:

on first page i code a textfield, then a submit button, submit button gets the string on textfield and writes down on a txt file ( <.. can i do this?)
then on second page i want each line of text to be stored like a variable string so i can play with it as i want.( showing , changing format, etc..)
My question is how can i acces inside a txt file, to get variables on strings stored in ??

Thx, u all

Can I Pass Variables In The URL String?
I am trying to get some variables into a loaded swf at runtime. The variables will carry information so the swf can load the correct xml file. I thought we could pass them through the URL string like so:

new URLRequest("testing.swf?myVar=varOne

but it just throws an URL cannot be found error. How can I get variables into my swf at runtime?

Pass XML String From PHP To Flash
Hi everyone, I'm hoping someone can help me out. I've been searching how to do this but haven't got it to work yet.

All I want to do is have flash call my php page which is putting together an xml string as a variable. I want to take that xmlstring in flash and parse it into my array.

I know how to do everything except load that XML string and parse it. I know how to parse an xml file, but a string is new to me. Also, for some reason when I try to get the XML string from PHP it comes back undefined.

Here is my Flash Actionscript:
// Call PHP and load XML string
loadVariablesNum("http://domain/recentimages.php","");

//My PHP file spits out the string as $recentxml, and it works fine. But when I try to trace that same string in Flash I get undefined.

//Here is the loop I've created to wait until the xml has been generated.

if (recentxml == undefined){

gotoAndPlay("loop");

} else if (recentxml != undefined){

gotoAndStop("finished");

}

//And here is the parsing method.
var myPhoto:XML = new XML();
myPhoto.parseXML(recentxml);
myPhoto.ignoreWhite = true;

Can anyone help? I would really appreciate any advice, I've been struggling with this for a while now and it's probably something easy.

Thanks, Matt

AS3 - How Can I Pass Vars Without Using URL String?
Hello,

I have one AS3 swf (loader.swf) that needs to load a second AS3 file (main.swf).

loader.swf has some variables that I would like to pass to main.swf.

I don't want to append the variables in the URL string, because then main.swf won't be cached properly.

In AS2 I could use FlashVars, which passes the variables without adding them to the URL string.

How can I do this in AS3?

Pass String Variable Into XML ULR
I am trying to pass a variable through "strSource:String" so that i can dynamically tell the player to load different videos depending upon which page it is on.

This works:
Code:

var strSource:String = root.loaderInfo.parameters.playlist == null ? "includes/video1.xml" : root.loaderInfo.parameters.playlist;

function initVideoPlayer():void {
   
   // create a new net connection, add event listener and connect
   // to null because we don't have a media server
   ncConnection = new NetConnection();
   ncConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
   ncConnection.connect(null);
   
   // create a new netstream with the net connection, add event
   // listener, set client to this for handling meta data and
   // set the buffer time to the value from the constant
   nsStream = new NetStream(ncConnection);
   nsStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
   nsStream.client = this;
   nsStream.bufferTime = BUFFER_TIME;
   
   // attach net stream to video object on the stage
   mcVideoControls.vidDisplay.attachNetStream(nsStream);
   // set the smoothing value from the constant
   mcVideoControls.vidDisplay.smoothing = SMOOTHING;
   
   // create new request for loading the playlist xml, add an event listener
   // and load it
   urlRequest = new URLRequest(strSource);
   urlLoader = new URLLoader();
   urlLoader.addEventListener(Event.COMPLETE, playlistLoaded);
   urlLoader.load(urlRequest);
}


Doesnt work if i try it like this:
Code:

var btnContent1:String = new String("includes/video1.xml");

var strSource:String = root.loaderInfo.parameters.playlist == null ? btnContent1 : root.loaderInfo.parameters.playlist;


Does anyone know why this is?

I can even put the URLRequest in as "includes/" + "video1" + ".xml" and it will work but as soon as i try to trade the "video1" for a string Variable it cannot find it.

My End hope to pass this variable through would be to have it on the HTML page where i could then dictate the exact path for the video XML
Code:

// source variables from HTML/js param
var btnContent1:String = root.loaderInfo.parameters["vOne"];
var btnContent2:String = root.loaderInfo.parameters["vTwo"];
var btnContent3:String = root.loaderInfo.parameters["vThree"];



Thanks for any help

will

Pass String To URLRequest
Hello,

I have only about 20 hours with flash and actionscript so I am very lost.
I like gotoandlearn,, I am learning most everything here..

but I am having trouble making a podcast lister and player for my church web site. I can not get my selectedItem string to pass to my URLRequest

I have my files at http://1newlife.us/test directory brousing is on so you can see what I am trying to do,, also have the fla file there

I know the player works because I can give it the url to a MP3 and it plays

Code:

var feedlist:URLRequest = new URLRequest('messages.xml');
var messagelist:URLLoader = new URLLoader(feedlist);
var sermon:Sound = new Sound();
var imageloader = new Loader();
addChild(imageloader);
messagelist.addEventListener(Event.COMPLETE, datahandler);


// **************Item change function***************
listbox.addEventListener(Event.CHANGE, itemChange);
function itemChange(e:Event):void
{
   textarea.text = listbox.selectedItem.data;
   datearea.text = listbox.selectedItem.pdate;
   linkarea.text = listbox.selectedItem.link;
   imagebox.source = listbox.selectedItem.image;
}


// *************what to do with the XML****************
var sermonlist:XML;
function datahandler(ev:Event):void {
   sermonlist = new XML(ev.target.data);
   var il:XMLList = sermonlist.channel.item;
   for(var i:uint=0; i<il.length(); i++)
   
      listbox.addItem({data:il.description.text()[i],
                  pdate:il.pubDate.text()[i],
                  link:il.guid.text()[i],
                  label:il.title.text()[i],
                  image:il.image.text()[i]
                  });
}


// ****************Sermon player need to stop all sounds first and add pause************

var sermonRequest:URLRequest = new URLRequest(listbox.selectedItem.link);  // here is the trouble the player works when I put "fileName.mp3"
var soundControl:SoundChannel = new SoundChannel();
var transform1:SoundTransform = new SoundTransform(1, 1);
sermon.load(sermonRequest);
playButton.addEventListener(MouseEvent.CLICK, playSound);
stopButton.addEventListener(MouseEvent.CLICK, stopSound);
soundUp_btn.addEventListener(MouseEvent.CLICK, soundUp);
soundDown_btn.addEventListener(MouseEvent.CLICK, soundDown);
function playSound(event:MouseEvent):void
{
soundControl = sermon.play();
}
function stopSound(event:MouseEvent):void
{
soundControl.stop();
}

// **** bug sound switches to right only *****

function soundUp(event:MouseEvent):void
{
transform1.volume += .1;
soundControl.soundTransform = transform1;
}
function soundDown(event:MouseEvent):void
{
transform1.volume -= .1;
soundControl.soundTransform = transform1;
}


// ******************Download button not working yet*******************
function getmp3(event:MouseEvent):void
{
    var mp3URL: URLRequest = new URLRequest(listbox.selectedItem.link);
    navigateToURL(mp3URL);
}
linkButton.addEventListener(MouseEvent.CLICK, getmp3);


// ******************Spectrum want this in small box******************
var ba:ByteArray = new ByteArray();
addEventListener(Event.ENTER_FRAME, loop);
function loop (e:Event):void
{
   graphics.clear();
   graphics.lineStyle(1, 0x000000);
   graphics.moveTo(-1, 150);
   SoundMixer.computeSpectrum(ba);
   for(var i:uint=0; i<256; i++)
   {
      var num:Number = ba.readFloat()*200 + 150;
      graphics.lineTo(i*2, num);
   }
}


I know this dose not look very good yet but I want it to work first.

Thank you for your time
Jay Robb

How Do Insert A Carriage Return Into A String
trying to add strings together to make a nice clean list. is there a way to add a carriage return into the target variable to separate the added items?

-joe

String.split(carriage Return) ?
hello,
i've got a long input text field named 'message'. when a send-button is clicked i need to split the message-string into an array at every point the user clicked return or enter on the keyboard. i have tried to split at
but it does not work:


messageArray = message.split("
");


i just don't know what i can put inside the ( ) so that at each return the string is splitted.


any ideas?
thanks, elo.

Forced Carriage Return In A String
I have a static text box i am using to display quotes.

Some quotes go over multiple lines (and I would like to force the return). How do I do this?

e.g.

arrQuote[1] = "Line 1" & [insert enter] & "Line2";

Return Class Instance As String
Is 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.

Remove Hard Return From String?
Hello,

I have a multiline textfield were users can type text. I split the text in words so I can compair them to see if they are a certain word. Some words don't pass the if statment even if they are the same (at leased to me). I found out it's because these words have a hard return in front of them. I need to remove the hard return, but I can't find out how. I tried to split the string on "
", but that doesn't work. I'm used to Java so maybe I look at this problem the wrong way. I hope someone can help me with this.

Thanks,
Ananta

AddLeadZeros To Number Return String
addLeadZeros(num:Number, totalSpaces:Number, addComma:Boolean):String

addLeadZeros EXAMPLE
Number : 51112211.45 ... addLeadZeros(Number, 8, true) : 51,112,211.45
Number : 12 ... addLeadZeros(Number, 4, false) : 0012
Number : 133.525 ... addLeadZeros(Number, 6, true) : 000,133.525
Number : 7 ... addLeadZeros(Number, 12, true) : 000,000,000,007

Remove Hard Return From String?
Hello,

I have a multiline textfield were users can type text. I split the text in words so I can compair them to see if they are a certain word. Some words don't pass the if statment even if they are the same (at leased to me). I found out it's because these words have a hard return in front of them. I need to remove the hard return, but I can't find out how. I tried to split the string on "
", but that doesn't work. I'm used to Java so maybe I look at this problem the wrong way. I hope someone can help me with this.

Thanks,
Ananta

Can I Pass A Var In FScommand Instead Of A Text String?
Can I use something like this?

fsvar = "Hello Word?";
fsfunction = "alert";

fscommand (fsfunction, fsvar);

Please help.

Thanks

How Do I Pass A String Variable To Javascipt?
In my actionscript, I have this variable pic="pic.jpg". I want to use it like this but it doesnt work:

getURL("javascript: OpenWindow(pic, 'newWindow','')");

It says the pic variable is undefined.

This, works:

getURL("javascript: OpenWindow('pic.jpg', 'newWindow','')");

But I do not want to use a literal directly like that.

How can I pass this variable to javascript so that it will recognize it as containing a string?

Simple Variable Pass From URL String
help! i know there is a simple solution to this, but I just can't find an answer anywhere. so i'm posting it here in hopes that some kind soul will pitty me and free me from this frustrating pothole.

What i'm trying to do is pass a variable to a flash file via a URL string... i.e.

http://www.needananswer.com?pothole=12

...and for the flash file to be able to receive and use it.

HOW?

How To Pass Carry String From Flash?
Is it possible to pass carry string from flash.
Example:
on some event I need to catch _y position of one object and to pass that variable to PHP script via URL.

Is it possible?

If it`s not, is there a way to write that variable in some txt file on server.. or something simillar..

Thanks folks!

[F8] Pass MC Name As String To Class Method.
I have sort of found a work around but its not exactly what I want so I just wanna check if theres another way.

Check working code below where mc name is not a String(i assume its an object?)


Code:
class myClass{
public function classMethod(obj:MovieClip, val:Number, act:String){
obj[act] = val;
}
}


Code:
import myClass;
var useClass:myClass = new myClass();
useClass.classMethod(mcName, 10, "_x");


Now I wanna pass the mc name as a string to the method but it doesnt work:

Code:
useClass.classMethod("mcName", 10, "_x");


I know I change the class obj type to :String but then the manipulation line will have to look something like _root[obj][act] = val; needless to say I dont like this as if I import the swf thats calling the method into another swf things go screwy cause the mc that im referencing would not lie on the root anymore etc.... Also tried using _level but it didnt work.

Pass Variable Via Query String
i'll try to explain this the best I can.

I have a flash header that I need included in a shopping cart site that will have nav and the header descriptions for each site page. It has 2 navigations, top and side. Side nav only controls the flash itself to display stuff that won't be in the rest of the site, like an about us section. The top nav controls what page the shopping cart goes to AND the flash header display. For example, when I click on my top nav button 'systems' I need it to go the 'systems page' and change the flash header to display info about the systems. Now when the 'system' button is clicked the page changes to the 'systems' page but since its a header the flash just pops up on the new page reloaded to its original state. So how would I fix this? could flash pass a variable via the query string to determine what frame it should be on when going to a new page?

Can You Still Pass Vars Through A Query String?
I'm trying to pass variables in through a query string appended to my url like so,

http://www.mydomain.com?myVar1=value1&myVar2=value2

From what i've read am i correct in thinking that i should be able to access these properties through 'this.loaderinfo.parameters'?

I don't seem to be able to get this to work for some reason? I'm able to get it tworking when passing in Flashvars through my html and then accessing them through the loaderinfo.parameters object, but not through a query string? Anyone got any ideas? Should this be possible?

Also i was wondering it there's any foreseeable issue passing in values both through Flashvars and a query string or should the loaderinfo.parameters object be populated with all the values?

cheers.

Can I Pass A Dynamic String To A URLRequest
I am wanting to use a button to change the value of a String variable, which is stored in a URLRequest, to dynamically change content loaded below the button based on which button is pressed.

Here is some AS 3.0:

var roomID:String = new String("default.swf");

var roomURL:URLRequest = new URLRequest(roomID);

var roomLoader:Loader = new Loader();

roomA10Button.addEventListener(MouseEvent.CLICK, onA10Click);

function onA10Click(event:MouseEvent):void
{
var roomID:String = String("roomA10.swf");
roomLoader.load(roomURL);
addChild(roomLoader);
}


I know some of my syntax is likely screwed up, specifically the "function onA10Click(event:MouseEvent):void" line, but I'm not in front of my code at the moment, so I'm just writing that stuff by memory. Anyway, the idea is to be able to define the String roomID a different value every time you click a button, which in turn updates the URLRequest, before the Loader kicks in and loads the content. Every time I try to do this, though, I get a URL Unknown error. I have traced the roomID String as well, and it seems to change fine with the clicking of buttons, but something's up with the URLRequest.

Any ideas?

Pass A Series Of Properties As A String
I want to pass a series of properties as a string to a webservice:

Version1: This works


Code:
var mxna_ws:WebService = new WebService(WS_URL);
var var1:String = "1";
var var2:String = "2";
var var3:String = "3";
var var4:String = "4";
var categories_pc:PendingCall = mxna_ws[smethod](var1,var2,var3,var4);
Version2:But why doesnt this?...


Code:
var mxna_ws:WebService = new WebService(WS_URL);
var var1:Object = '"1","2","3","4"';
var categories_pc:PendingCall = mxna_ws[smethod](var1);

[F8] ComboBox Component: How Do I Get It To Return A GetURL String?
Hello board,

I need a combo box that will return me some strings via getURL when I click on the options. I use Flash embedded in Director, and I can get Director scripts to run from Flash by using getURL.

It's just a simple Combo Box with 3 options. One of them should return getURL ("lingo: go next"), the other should return getURL ("event:alert2"), and the other should return getURL ("event:custom_01").

Anyway I've been messing around with the combo box component, but my attempts with the data parameter have been fruitless so far and I suspect I need some ActionScripting at a keyframe...

[F8] Return String Based On Button Pressed?
I have a clip called "Cabell". It is one of many clips based on school names.

When I rollover the clip "Cabell" I need a pop-up to appear that says "Cabell Elementary". BUT, another clip named "Adams" should return "Bryan Adams High School". So they're not all elementaries.

My first thought was to just create a 1 item array like:
Cabell.Array = ["Cabell Elementary"];

and then code the clip like:
Cabell.onRollOver = function() { schoolName = this._name[0];}

But that doesn't seem to work. Any suggestions on how to cull the clip's name for use in determining the full name?

Eternal thanks, as always.

-Layne

Return Split() Array Back To A String
ola,

I have loaded external data into flash, got a word count using split(" ").length, and now want to put only the first 10 words of the file into a text field. this is where my brain stops, i have also made an array of all the words but still can't glue them back together as a single string in a text field... am I missing the obvious... thanks in advance for any help.


smashing

Function Return (String) Character Limited?
Hi,

I just discovered something strange with this simple function:

Up until 188029 characters everything goes fine. But when 1 more character is added (188030), the complete function fails, including all the tracers.

Did I hit a limit here?
What possibilities are there to circumvent this limit?
A String(literal) doesn't have this character-limit!!
I have a 'Very Long String", which is a SVG-template (332000 characters, 4650 lines), in which a couple of variables need to be inserted. But because of this 'limit' I can't do anything with it.








Attach Code

function simpleFunction():Number{
var myString:String = "This is a very long string";
myString += "Add more and more characters;
[etc.. etc..]
return myString .length;
}

























Edited: 11/22/2007 at 09:02:04 AM by Bl4deRunner

ASP: Pass A String Using Flash GETURL To Another ASP Document
In my ASP/html document I use the following code to carry/pass the username/school of a logged user to the next ASP document:


PHP Code:



<a href="projects.asp?name=<% =strUserName %>&school=<% =strSchoolName %>"




(not PHP but otherwise cant paste in the code.... why dont you guys have an ASP tag :P )

My question is how would I put this into a geturl statement in a flash button so that i can pass the asp strings using flash as a frontend to the next asp file?

I try just sticking in the link then the asp code but it doesn't.

Effectively the flash file button urls should retrieve the username/school for the next document but am having no luck ://

Any help appreciated.

[F8] Dynamic Query String & Pass Variables To And Fro Php
Hi!

I have a webpage that needs to load a variable from query string and then the swf sends this variable to php to search it in databse and return respective entries.

My trouble is the page where the swf is placed in an HTML page whose URL is something like this : http://www.mysite.com/variableName=dynamicValue

Actually this is a link thats sent in an email. When clicked it loads this page. Here http://www.mysite.com/variableName= is static, but dynamicValue is a 15 letter randomly generated code.

I wanted to know is it possible to pass this dynamic value of the variable into my swf. If so, how to do that.

My second query is I wanted to send this variable from flash to a php file which will search it in a database and return related entries to flash. Now, I've done this seperately, that is, send variables to php by post method and get variables from php by get method. But I dont know how to do these two operations in one single call.

I am using Flash 8, though i'm exporting the movie to flash 6 player compatible and actionscript 2. Any help is welcome. Please let me have the feedback.

thanks

ashwin.

EventListener Troubles - How To Pass String To Function?
Hey guys, been cruising the forums and google about this, still confused. I have a series of buttons, which on mouse press need to pass a string to a function. i just dont understand how to do this easily with event listeners


ActionScript Code:
function showLocations(event:MouseEvent):void {    var state = arguments.caller.state;    var w = 640;    var h = 480;    var jscommand:String = "if (!win || win.closed) { var win = window.open('http://dev.calendarxpress.com.au/locations.php?state="+state+"','Locations','height=480,width=640,toolbar=no,scrollbars=yes,resizable=yes,top='+((screen.height/2)-("+h+"/2))+',left='+((screen.width/2)-("+w+"/2)));} else { win.focus();}";    var url:URLRequest = new URLRequest("javascript:" + jscommand + " void(0);");    url.method = URLRequestMethod.GET;    //url.data = vars;        try {        navigateToURL(url, "_self");        status_txt.text = "Opening window...";    } catch (e:Error) {        status_txt.text = "Error";    }    }vic_btn.addEventListener(MouseEvent.CLICK, showLocations);vic.btn.state = 'vic';

Pass Variables Into Flash Via Query String
I used to do this all the time to pass in simple values to Flash but with Flash 8 it doesn't seem to be working properly. I've stripped it down to it's most basic and it still doesn't seem to be working. I've got a test page here:
http://icglink.com/flashtest/

The top set uses the standard object/embed method, the left one passing in a 0, the right passing in a 1. Both use the variable named previousvisitor.

The bottom set use the same variable and value structure, but with the swfobject javascript call instead of the object/embed method.

I've got a case statement on the 5th frame that tests the incoming variable and directs the playhead to one frame label or another. The idea is that if someone has come to the site for the first time, they'll get to see a video. If not, they'll get a still frame with a "play video" button.

I'm also including a link to the FLA (version 8 remember).

http://icglink.com/flashtest/cookieTEST.fla

So does anyone have ANY idea why this isn't working correctly? I really need to get this working and it should be dead simple.

Submitting Empty String Does Not Return Correct Message
Hi there,

I wrote last week with a project where I could get my movie to recognize abbreviations and return the complete phrase for that abbreviation. Well, I've got it working...mostly.

Here's the overview.
Two text fields; 1 is input and the other display.
Enter any text in input, including an abbreviation such as tbd and click enter. The display text shows the same text, except tbd has been replaced with 'to be determined.

If you don't enter any text, or if you enter text without an abbreviation, then you SHOULD get a message saying "please enter text using an abbreviation."

The problem: If you enter random text WITHOUT an abbreviation, the message returns as intended, ie. please enter text with an abbreviation. HOWEVER, if you leave the input field blank and click the enter button, then it returns the WRONG string... It pulls the + "to be determined" text, rather than the "please enter text..." string. Looking at the code, it will be more clear. Basically, If (toBe == -1)then the "please enter text..." string should display. If (tobe<> -1) then the First + "to be determined" + Last message should be displayed.

code:
button_btn.onPress=function(){

toBe=input_str.indexOf("tbd ");

if (toBe == -1){
output_str= "Please enter some text and an abbreviation." ;
}

if (toBe <> -1){
first=input_str.substr(0,toBe);
last=input_str.substr(toBe+3);
output_str=first + " to be determined " + last;
}
};


Again, the problem is that when the input field is left blank and the user clicks the enter button, then instead of the "please enter text" message displaying, the first + "to be determined"+last string displays. Woe is me. Please help me correct the error of my ways...

Thanks!

[AS3] Trying To Send Information Out To My Webpage With Amfphp And Return A String Wh
Hello everyone, I am trying to send information out to my webpage with Amfphp and return a string which I put into a variable called filepath. The only problem is that I get a whole slew of errors concerning variable types. Why?! It's a nooby question I know. Please help!!!

Here is my code:


ActionScript Code:
import flash.net.*;

var gw:NetConnection = new NetConnection();
gw.connect("http://mysite.com/amfphp/gateway.php");

if (_root.loaderInfo.parameters["audioid"] != null) audioid.String = _root.loaderInfo.parameters["audioid"];

var res:Responder = new Responder(onResult, onFault);

function onResult(responds:Object):void
{
    // Get result and put into filepath variable
    var filepath:String = new String();
    filepath = responds;
}

function onFault(responds:Object):void
{
    for(var i in responds)
    {
        trace(responds[i]);
    }
}

gw.call("counter.get_filepath", res, saudioid);

If anyone knows what is wrong I will be very grateful!

-Pianoman993

Copyright © 2005-08 www.BigResource.com, All rights reserved