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




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?



Adobe > ActionScript 3
Posted on: 02/06/2008 11:00:34 AM


View Complete Forum Thread with Replies

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

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 You Pass Parameter To Urlrequest?
Im trying to build a mp3 player, so when the user clicks a button it loads the right track. How would I pass the right track to the urlrequest to load the right track? This plays the sound fine:


Code:
var request:URLRequest = new URLRequest("Audio/One.mp3");
_track1.load(request);
but this does not work:


Code:
var request:URLRequest = new URLRequest(request);
_track1.load("Audio/One.mp3");
I just dont want to have seperate urlrequests for each track that I want to load, or do I have to? Cant i just pass the mp3 to load to the urlrequest?


edit: sorry I just read my post and it doesnt make sense. my head is spinning trying to learn this stuff too fast.

Im just trying to have a button pass the track to be loaded to the urlrequest so it loads the right mp3.

[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.

Passing Var:string To New URLRequest
Hi,

I have a main movie on which I have two buttons that each should load a new external movie when clicked.

The code on frame one for each button is:

Code:
function onIntroClick(evt:MouseEvent):void {
var language:String="english.swf"
gotoAndPlay(2);
}
english.addEventListener(MouseEvent.CLICK, onIntroClick);


and


Code:
function onIntroClick2(evt:MouseEvent):void {
var language:String="french.swf"
gotoAndPlay(2);
}
french.addEventListener(MouseEvent.CLICK, onIntroClick2);


on frame 20 I have the following code, which should load the external movie (either the english.swf or the french.swf) in the main movie.

The code is as follows :

Code:
var l:Loader = new Loader();
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
l.load(new URLRequest(language));

function loop(e:ProgressEvent):void
{
var perc:Number = e.bytesLoaded / e.bytesTotal;
percent.text = Math.ceil(perc*100).toString();
}

function done(e:Event):void
{
removeChildAt(0);
percent = null;
addChild(l);
}
stop();


This doesn't work as I get an error 1120: access of undefined property language.

What am I doing wrong or what should I do to do it right ?

Thanks for your assistance.

Smalco

Pass URL String From External File To AS Variable (dynamic File Names)
I have a movie player that works fine when i hard-code the url value in the video function, but when i try to pass that url/file path from an external file, the video doesn't load. I suspect that there is something i'm doing wrong with the quotes. What am i doing wrong?


Code:
var vfile:String = string("path");

supervideo = function () {
var netConn:NetConnection = new NetConnection();
netConn.connect(null);
var netStream:NetStream = new NetStream (netConn);
video.attachVideo(netStream);
netStream.setBufferTime(10);
netStream.play(vfile);

};

loadText.load(_global.text_url1);
loadText.onLoad = function(success) {
if(success){
showtitle.text = this.title1;
vfile = this.flv_name;
supervideo();
}
}
The value in the php file looks like this:

PHP Code:



&flv_name="elements/flv/superape.flv"& 




So ultimately i want to end up with netStream.play("elements/flv/superape.flv");. I know the value of vfile is being passed from the php file and getting into the supervideo(); function because i have a textbox echoing vfile. I have tried defining the variable with and without the ":String". Please let me know if you can see any errors. Thanks!

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

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?

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

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

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?

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

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.

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);

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.

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.

Pass Frame Variable Via Query String Bettween 2 Swf In 2 Different Html Files
Hello, I have an swf movie embedded in an HTML. One of the links calls to another HTML with a different SWF embedded. I need to link back to the original HTML/SWF but to a certain frame within that SWF using HTTP query. I understand that I can do this with Javascript and by parsing the HTTP query. Can anyone direct me to a tutorial or give me some help?

Thank you

maknenoiz

Keeping A String A String With Dynamic Text
I've got some dynamic text (from MYSQL & ColdFusion) that needs to be kept as a string and is (i think) being converted into a number.

The recordset is returning 8'6" (eight feet, six inches)

and my dyn text box displays 86.

Anyway around this from within Flash? I know you can strict data type in AS 2.0 but no chance of migrating this project to 2.0!

How Can I Pass A Dynamic Value To Another Frame?
Hi
How can I pass (or send) the value of a variable to another frame?
Thanks

Dynamic Menu Pass Variable OnRelease
I am building a dynamic gallery and I am trying to set a global variable so I can load a certain gallery on a different frame in the timeline.

I am unable to set the _global variable from within the button.onRelease function because I guess the scope is wrong


ActionScript Code:
stop();

galleries = new LoadVars();
for (j=1; j<=_global.num_galleries; j++) {
    galleries["gal"+j]="empty";
    galleries["galID"+j]="empty";
    }
// set var for phpfile that spits out gallery names and id
phpfile="http://www.seanbranch.com/progallery/galleryData.php";
galleries.load(phpfile);
galleries.onLoad = function(success) {
    if (success) {
        trace("Variables loaded");
        for (i=1; i<=_global.num_galleries; i++) {
            currLink = _root.nav.attachMovie("gallery_name","gal"+i, i);
            currLink = eval(currLink);
            currLink._x = 0;
            currLink._y = 35+i*currLink._height;
            currLink.textBox.text = galleries["gal"+i]; 
            currLink.link_button.onRelease = function()
            {
                _global.gallerynum=galleries["galID"+i];
                gotoAndStop("load_gallery");             
            }                     
        }
    } else {
        trace("Could not load variables");
    }
}

everything works except where I am trying to set the global gallerynum var.
galleries["galID"+i]; seems to be undefined inside the onRelase function

any ideas on how to set or pass this data since everything is dynamic?

Attach Eventlisteners To Dynamic Movieclips And Pass A Variable.
Hi there,

I have a mc (changeColorMc) and three movieclips. The three movieclips are created on the fly (so there could be more movieclips) and filled with a color from an Array. This works fine.

Now I want to add an eventlistener for each movieclip, so when someone push one of the movieclips the movieclip with the name "changeColorMc" gets that same color from the colorArray.

My question is: How can I pass the color value from the colorArray to the buttonPressed function? Is this possible?

I was also thinking that I had to create three buttonPressed functions ie. buttonPressed1, buttonPressed2 and buttonPressed3 and attach these to the created movieclips.. but how? Because I don't know up front how many movieclips there will be..

Thanks Peter.

My code:








Attach Code

var colorArray:Array = [0xCC0000,0x00CC00,0x0000CC];

for (var i:uint=0; i<2; i++)
{
var mc:MovieClip = new MovieClip();
mc.graphics.lineStyle(1);
mc.graphics.beginFill(colorArray[i]);
mc.graphics.drawCircle(10, 0, 10);
mc.graphics.endFill();
mc.name = "test"+i;
mc.x = 20*i;
mc.y = 20;
addChild(mc);

var colorTransform:ColorTransform = mc.transform.colorTransform;
mc.addEventListener(MouseEvent.MOUSE_UP,buttonPressed);

function buttonPressed(event:MouseEvent)
{
colorTransform.color = colorArray[i];
changeColorMc.transform.colorTransform = colorTransform;
}

addChild(mc);

}

Pass Actionscript Code Through Variable (dynamic Buttons)
i have some dynamic MC buttons which are working great but i want to basically inject what the onrelease code is for each button usng on onLoad command. Right now onLoad sends the button label and i would like to send the actionscript code as well.

On the MC that holds the button the onLoad passes this.label = "button label"; correctly. command = 'trace("osaka!");' passes that info to
ActionScript Code:
on(release) {    command    }
inside, but it treats it as text and not code. So how can i pass actionscript commands so they fill in the variables inside the button?


Thanks.

Pass Actionscript Code Through Variable (dynamic Buttons)
i have some dynamic MC buttons which are working great but i want to basically inject what the onrelease code is for each button usng on onLoad command. Right now onLoad sends the button label and i would like to send the actionscript code as well.

On the MC that holds the button the onLoad passes this.label = "button label"; correctly. command = 'trace("osaka!");' passes that info to
ActionScript Code:
on(release) {    command    }
inside, but it treats it as text and not code. So how can i pass actionscript commands so they fill in the variables inside the button?


Thanks.

Pass Variable With String From One Flash File To Another Flash File
There are two flash files which are developed in Flash MX 2004 Professional and its names are Main.fla&Child.fla.
I have created a Input text box in Main.fla and enter text during runtime. When I click a button in the same Main.fla file, the text entered should display in the dynamic text box which is created in Child.fla. But, I am not getting appropriate logic to achieve this task.
Request you to kindly send appropriate logic. It is urgent.

How To Execute A Dynamic String
Hello. I am trying to build a breadcrumb function so there is a navigational trail based on what content the user is viewing. Here is the code I am using:

function breadCrumb () {
//retrieve a 1-4 value corresponding to the 4 main nav areas location = _root.vars:loc;
//dynamically assign value to primloc that corresponds to established variables (nav1loc, nav2lock, etc.) denoting literal nav titles
primloc = _root.vars["nav"+location+"loc"];
//this is what wont work. it returns "navXElements", where X is the value of the active subnav tab, but as a literal string. I need it to execute so it returns and pringts the variable stored in _root.vars
secloc = "nav"+location+Elements+"["+_root.vars:subloc+"]";
trail = primloc(secloc);
}

Does this make sense? How can I force a literal string to execute?

Thanks for any help, and if this code is not enough for a proper "diagnosis" i can post the .fla somewhere.

Noah Pedrini

Split Dynamic String
I came accross something similar once, when I was trying to strip dynamic numbers without explicitly referencing the value as a Number.

However, in this case, vImage is a mixed string, and seems to only work if it is hard-coded.
code: _root.variables.currentImage = this;
trace ("currentImage = " add _root.variables.currentImage);

/* Set value of currently selected thumb. */
vImage = _root.variables.currentImage;
trace ("vImage = " add vImage);

/* Remove first 30 characters from vImage, and assign result to ImgStr. */
ImgStr = Number (vImage.slice(29, vImage.length));
ImgStr = ImgStr +1;
trace ("ImgStr = " add ImgStr);

If I hardcode an expected result it works fine. Example:
code:
vImage = "_level0.thumbnails.thumbnail.2";

Could someone explain to me why this is not working? thanks.

Dynamic Variable Using String From XML
[Im currently using Flex builder 3 ]

I want to have a dynamic expression in actionscript

Code:
//skey is a label which should contain the xml node VALUE
skey.text = 'reftables_additem_load_dataprovider.lastResult.DATARESULTS.VER_DATA.' + stringfunctions.toString();
Alert.show(skey.text);
Currently it shows reftables_additem_load_dataprovider.lastResult.DAT ARESULTS.VER_DATA.VEHICLE_SKEY
which is correct behavior but now how do i use that text to get the value from the dataprovider?

normally i specify


Code:
tmp.text = dataprovider.lastResult.DATARESULTS.VER_DATA.VEHICLE_SKEY;
But its treating it as an entire string

heres my current code

Code:
var stringfunctions:String = new String();
var searchfor_skey:Number = new Number();
stringfunctions = columnData.field;
//search for primary key
searchfor_skey = stringfunctions.indexOf("SKEY", 0);

if(searchfor_skey != -1){
//we got the skey column now store the value in the text box for http service later when saving !
skey.text = reftables_additem_load_dataprovider.lastResult.DATARESULTS.VER_DATA. + searchfor_skey.toString();
Alert.show(skey.text); //shows just string

Alert.show(reftables_additem_load_dataprovider.lastResult.DATARESULTS.VER_DATA.VEHICLE_SKEY); //WORKS showing value?


}

Dynamic Menu From String (please Help)
I have a nicely concatenated string here that I am trying to integrate into a dynamic menu FLA I found here, while trying to follow along with its poorly worded tutorial here . Although I am making progress, I'm a week in now & it's time to ask for some help.

It seems to me if I could get the variables inserted properly it would work, I'm currently trying:

ActionScript Code:
["Label"+i] == (myVars["modname"+i]);

and all the variations of that I could fathom, without success.

My attempts at reconciling this are within frame 1 of the main clip in this .fla, and my best (working) attempt at rendering my variables on their own is here .

If someone could get this to work or show me how to get this to work, I would really appreciate it. Failing that, please show me another way to make a dynamic menu with submenus from a concatenated string, not XML. If walking me through it please be as exact as you can, I'm fairly new to the wonderful world of ActionScript.

A million thanks in advance...

Quick Dynamic String Help
Trying to switch visibility of an object on with the following dynamic call - doesnt seem to work any ideas?

this['lineHolder.line' + i]._visible = true

I can use the manual method fine though!!!

lineHolder.line1._visible = true

Cheers

Drag And Drop Dynamic String
Hi there,

this is a hard to explain problem I have. I'm trying to do the following:

- a string (sentence) is read into Flash from a textfile;
- this sentence should be displayed as a sentence in Flash;
- every seperate word should be draggable;

Example:
- imagine that the sentence is "The quick brown fox";
- Flash displayes this sentence and the user can drag every word seperatly, 'The', 'quick', 'brown' and 'fox'.
- it must be able to change the sentence and then the functionallity should stay the same without changing the code in Flash....

Picture to illustrate the problem:



Does anyone have a clue how to solve this problem?

Greets,

Dynamic Assign TextField From String?
Hi,

I'm writing a scrollbar class... (FMX 2004 pro)
In the component definition of the MovieClip that is assigned to this class, I have an variable target_textfield (String).

This String should be the name and path of the TextField that should be controlled by the scrollbar.
In my class i've declared this string the following way:

var target_textfield : String; // i.e. "_root.MyTextField"

My problem is that i need this string to be converted so it actually revers to the TextField.
I've tried using:

var TargetTextField : TextField = eval(target_textfield);
TargetTextField.scroll = current_scrollpos;

But this gives me this error:
"Type mismatch in assignment statement: found String where TextField is required."

How can i do this correctly? Any ideas?

Regards,
PJ

Dynamic Array Access String
My apologies if this is the wrong term, Don't know what to call it thus making it difficult to search for!

I am trying to do make NewVar return "three" (myArray[3])

myArray = ("one","two","three","four");
YourArray = ("A","b","c","d");
WhichArray = "myArray";
i="3";
ArrayString = (WhichArray + "[" + i + "]");
trace(ArrayString); //output = MyArray[3]
trace(eval(ArrayString)); //output = undifined
NewVar = ArrayString
trace(NewVar) //output = MyArray[3], desired result = Three

Any help would be much appreciated as well as make my brain stop hurting.

MrKicks

Dynamic Text / String Problem
I'd like to add commas in a dynamic text string for money amounts. See swf file here.

This is what the current code looks like without the commas:
code: on (press) {
bank = bank - 700;
bank_txt = "$"+ bank;
trace(bank_txt);

spent = spent + 700;
spent_txt = "$"+ spent;
trace(spent_txt);
}
This is what I've been trying to make work, but it returns "$undefined"
code: bank_txt= "$"+bank.toString().Substr(0,bank.toString().lengt h-2)+","+bank.toString().Substr(bank.toString().leng th-2,bank.toString().length);
Can you tell why this doesn't work?

Access Instance Name From Dynamic Txt String...?
I'm accessing a string (which is also an instance name) from a text file which is loaded on to a dynamic text box. Now I want to access the corresponding movie clip with the same instance name as of that string. So, if you actually look at it, the code would look something like as follows,

Considering the following:

- "varCheck" is the instance name of the dynamic textbox.
- "mc1" is the string it contains AND the instance name of an existing movie clip.

My mission: To play the 2nd frame of "mc1" movieclip...

Presumed code,

_root.varCheck.text.gotoAndPlay(2); <-- this is wrong but it shows what I'm trying to do

So, help anyone?????

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