ActionScript 3.0 :: Retrieve Variables Sent From NavigateToUrl()?
Oct 11, 2009
Is possible use navigateToUrl() passing some variables to the url itself ?Suppose that the url requested opens another page that contains a swf file.How can i retrieve these variables ?
I want to open a php page by linking to it from Flash, however I need to pass a variable to it to view the data.I have been trying this unsuccessfully:
ActionScript Code: var url:String = "data.php?studentID="+_dataModel.studentID; var request:URLRequest = new URLRequest(url);
I really need to send a variable via POST method to an URL and the navigate to it. navigateToURL sends variables using GET method, although I specified POST. URLLoader sends variables using POST method, but does not navigate to the URL.
I'm trying to do a usual reading of variables from a PHP file, and I'm getting error 2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.I have tried to open the remote .php file in my browser, and the output is perfect. The variables are all in the format variable1=value1&variable2=value2, etc. And yes, I know about the thing with the initial '&' character and have removed it, to no avail.
Now, I have COPIED the exact text that the PHP outputs from my browser, and I've PASTED it into a .txt file. Then I uploaded the .txt file to my server. Then I changed the route in the URLRequest object from "...myfile.php" to "...myfile.txt". it works perfectly.So... what could be the difference between the text that the .php file prints vs the text that the .txt file prints, for flash to NOT read it?
I am working on a project where I am getting some data back into my .swf via FlashVars. They are being sent back in a HTML Code: <param name = "FlashVars value ="resultstring=&username=value&userfirstname=value&userlocation=value" I am not sure how to target the resultstring in actionscript to retrieve all of the different variables?
I am trying to retrieve some information back from my LMS and into variables in Flash with AS3. I used to be able to do this without any problems in AS2, but can't seem to find a way to make this work in AS3. In AS2, publishing with the "Flash with SCORM 1.2 Tracking" option, I could call a line like the following:
This would grab the student name from the LMS and store it in Flash in the variable named stuname.
Any way to do this with AS3? I can set values back to the LMS no problem still through fscommand such as score or completion, I just can't get anything back from the LMS such as student name or lesson location.
I am scratching my head because there isn't much out there even in the forum on something this simple.[code]...
Here is what I am trying to accomplish I am able to retrieve these variables from the txt file that is stored with the SWF file and display them, I am unable to allow the user to change a line "item" and then have them save it amending the TXT file.
So the goal is to have this list on multiple office computers so that you can go in add an item to the list it then updated the TXT file so the next user can open up the flash file see the list and even add or remove an item.
The TXT file is going to be stored on a private drop box folder that is available on all computers concerned. ( If it's going to be easier than putting it server side )
i have an xml file and i have created a gallery that loads thumbs at the start.what i want is that when user click on one of the thumb then it should open the big picture in another browser. i actually use it for swf files. swf files will be loaded in other window. my code is here
Code: var xmlLoader:URLLoader = new URLLoader(); var imageLoader:Loader; var xmlList:XMLList;
var req:URLRequest = new URLRequest ("http://localhost/SE/processimage.php"); var vars:URLVariables = new URLVariables (); vars.awd = "awd";
[code]...
When I load that url the variable is sent using the GET method instead. It appears in the url in the browser and the browser shows an error first then "awd", meaning it worked for $_GET. I tried both req.methods and tried adding "_self" and "_blank" and also on different browsers. It still uses GET.
I'm having problems with creating a for loop to work with my CLICK state with navigateToURL.Can someone please show me the ways of my errors. I'm sure it is simple. Been out of the game for a while and coming in new to AS3. The roll states work fine.[code]
currently i have the main scene and within this scene i have a button with the value bg_src Also in the scene is a movieclip containing several frames, each frame with a different image and stop();, a different button simply tells this movieclip to go to the next frame, the last frame in that movieclip returns it to the first frame, so it will continuously loop through the images when the button is clicked, one image at a time.
Problem i am having is that i want the button with the value bg_src to link to the original source of the background images when it is clicked, whilst remaining part of the main scene and not within the movieclip.
lets assume image1 was [URL] and image2 was [URL] clicking the background change button would switch the background image to the second image, and the background source button would then, instead of opening a new page to[URL] when clicked, would then open a page to [URL]instead.
The code i have thus far is as follows :
Code:
bg_src.addEventListener(MouseEvent.CLICK, onBgsrc, false, 0, true); var buttontext:TextFormat = new TextFormat(); buttontext.font = "Verdana"; buttontext.color = 0x424647;
So I googled this problem and found like 3 threads with the exact same problem and what fixed their problem didn't fix mine, plus those threads are pretty dated. So I thought I'd get a more up to date answer.
[Code]...
When I load that url the variable is sent using the GET method instead. It appears in the url in the browser and the browser shows an error first then "awd", meaning it worked for $_GET. I tried both req.methods and tried adding "_self" and "_blank" and also on different browsers. It still uses GET.
I'm having problems with my animation getting cut of by my navigateToURL code. What is supposed to happen is,If you click on "buttonBtn" it triggers a animation. At the end of the animation it is supposed to stop and bring up a url. I've used gotoAndPlay ("frm") and navigateToUrl. Each time I test it in the browser the animation will begin, but the url comes up before the animation is finished. How do I allow the animation to play all the way through and then retrieve the url?
stop(); //SimpleButton ButtonBtn; function handleClick( pEvent:MouseEvent):void {
i've created a flash animation with as3. at the end of the timeline i've got a stop(); action on the last frame which is working just fine. on the following frame i have the navigatetourl action navigateToURL(new URLRequest [URL]} for some reason which i've been incapable of figuring out it will not automatically flip to the page i have written in my action when the animation has finished playing.
I'm kinda new with Flash but I've managed to create a menu for a homepage. Now when I click on one of the menu links - the page opens up in a new window. But I don't want that at all. I want the page to open up in another frame called mainframe. I've tried a number of things already; changing from "mainframe" to "_mainframe" and back, trippelchecking that the frames name really is mainframe so there's no typo. I've also changed the name of the mainframe both in the htmlfile and the code but that didn't work either.
Here's my code: var linkabout:URLRequest = new URLRequest("about.html"); //...// function aboutClick(event: MouseEvent):void { if(subDown[1] == true) { //true = submenyn Īr nere o ska upp subAbout_mc.gotoAndPlay(15); [Code] .....
On a game we just completed in Flash Builder 4, there are a couple of links like this:
var sponsorLink:String = http://www.plantersplace.com/; navigateToURL(new URLRequest(sponsorLink), _blank);
IE 7 in some installations is treating this as a popup. Firefox 3.6, Chrome 5, Safari 4 all fine.
The game in question is at [URL]
Click "continue without logging in, then click "show hint". Click the hint. This should fire the above code and open a new window.
Several users in IE report this gives them a pop up alert. I am trying to find out why and what can be done about it. I have tried the solution I found at Zorked but people STILL say they are getting popup alerts.
I had developed a whole series of tutorials using Flash CS4 (AS3). To load various modules I used the the following code:
Button_btn.addEventListener(MouseEvent.CLICK, btnClick); function btnClick(event:MouseEvent):void {[code]...
This works great with CS4 but when I stated using CS5 and exported my swf files, it stopped working. It seems that its trying to find the page over the internet and not the local directory anymore.
I'm fairly new to actionscript. I have created a flash banner ad that is now hosted on a site. Whenever somebody clicks the banner IE responds witha a "pop-up blocked"!
The code that handles this is: ActionScript Code: clicky.addEventListener(MouseEvent.CLICK, gotourl); function gotourl(e:MouseEvent):void { if (root.loaderInfo.parameters.clickTAG.substr(0,5)=="http:") { navigateToURL(new URLRequest(root.loaderInfo.parameters.clickTAG),"_blank"); }}
Where "clicky" is a SimpleButton that covers the entire flash. clickTAG is passed as an argument as to where to navigate. If I allow pop-ups everything works as it should! Howvere disabling pop-ups shouldnt be needed - and i see that other flash ads on the site works without and pop-up warning.
I am using the following line of code in my Flash movie: navigateToURL(request,"_blank");However, when I am using Internet Explorer 7 (with tabbed browsing enabled), and this code is called to open a link, the link is opened in a new tab, but IE7 does not switch you to view that tab as you would expect!When I open a link in a normal web page in IE7 (and the link opens in a new tab because _blank was specified in the HTML code for that link), IE7 will switch you to that new tab to see the web page you just opened, so why does it not happen when using Flash?I know that within the settings for IE7, there is a setting that you can tick that says, Always switch to new tabs when they are created, and this solves the problem. However, many web site visitors will not have this ticked.How can I make sure that when a user opens a link in a new tab from my Flash movie, IE7 switches to that tab?I am using ActionScript 3.0 and Flash CS4.
Maybe someone in this forum can give me some help. Here is what I'm trying to do... I have page that when you click any of the buttons, it triggers the same animation. Now, depending on which button you click, it will take you to a different url. My problem is, with the code I have, the animation gets cut off before it's finished and goes straight to the url. I know I need some type of listener or something to watch for the end of the animation before going to the url. I can't seem to figure out what that code is or where it needs to go. Also, my animation is not in a movie clip. It's all in Scene 1. I've got the following script in the first frame of the actions layer. I'm only about three weeks into self-teaching AS3, so tell me like a third grader what is up.[code]
I have a series of buttons that I want to act as links. In firefox and safari, the links work fine, but in IE, it reacts as if I hit the reload button..This is the code I am using:
Code: private function launchCourse(event:MouseEvent):void {
I have a problem in Flash CS3 using AS3 which is driving me nuts. What I am doing seems easy enough and it works fine on Macintosh under Firefox and Safari, but I can't get it to work on Windows under Firefox 2 or IE 7.
I have a button on the stage with an animation that leads up to it's reveal, hence the stop() function in the AS. The button is labelled "Web_btn" and the purpose is to open a web site when the user clicks on the button. Ideally I would like the button to open in a new window but I understand that that is a problem due to web blockers so I have chosen to use "_self" for now. On the Mac (OSX 10.5.8 and Flash 10) everything works as expected but on Windows (XP SP3 and Flash 10) when I click on the button nothing happens. Here is the code I am using:
what I'm using in a Mac projector that's on a CD-ROM:
Code: protected function get urlRequest():URLRequest { return new URLRequest("http://www.kirupa.com");
[code]...
Basically, all I want is a thing where:a user puts in a CD-ROMopens the projectorclicks a button and the user's browser goes to the specified web pageThis works fine on a PC projector. On a Mac, it never opens the page. It seems like the Mac puts the focus on the default browser program, but never goes to the URL.
<div id="menu"> //here the code for a flash menu </div> <div id="content"> //here I want to show a flash movie accordingly to the button clicked on the menu </div>
I want to show the pages inside the div "content" without reload the whole page, can I do this with navigateToURL()? Can it interact with a js function or an Ajax call?