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
FlashKit > Flash Help > Actionscript 3.0
Posted on: 10-22-2008, 05:34 PM
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
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?
Passing SQL String To PHP
hi...
what im trying to do is: pass a complete sql string to a php script. this works fine for passing numbers for the SQL WHERE conditions (e.g. "SELECT * FROM myTable WHERE YEAR(mydate)=2005").
but as soon as i try sending strings (e.g. "SELECT * FROM myTable WHERE YEAR(mydate)=2005 AND item='myItem'"), php just won't process it.
the same goes if i wrap that statement into escape();
i also tried putting in and leaving out the inverted commas....
I'm using loadVars() and sendAndLoad() for this action...
anyone ever encountered this problem???
Passing XML String
Alright, so I am trying to pass an XML file as a String from a JSP page. I know the JSP code works and it creates a String of XML data that is formatted correctly, however when I try to load into my flash I am getting undefined errors.
This flash code works if I try to load a file locally or off the server, but unfortunately I cannot load it that way, I need to load it from this JSP as a String.
Here is the AS code:
Code:
myXml = new XML();
myXml.load("rssloader.jsp");
news = new XMLSA();
news.load(myXml);
XMLSA just takes a formatted XML() object and returns it as an array, this has all been verified to work as well.
Passing A String
Ok, so Im passing a param (proLabel) from an asfunction to another function (byeByeContent). It traces correctly from byeByeContent function, but will not work as a frame label. If I replace the param with the string "pro1" all works fine. Whats wrong?
Attach Code
// asfunc
function showPro(proLabel:String) {
proHighlightClick = true;
byeByeContent(mNavContent_3_mc,"NA",proLabel);
reset();
mNavbar_mc.mNav_3_btn.enabled = false;
mNavbar_mc.mNav_3_btn.btnAni_mc.gotoAndPlay(11);
//trace(proLabel);
}
// show/hide content
function byeByeContent(viewContent:MovieClip, bannerPos:String, proPos:String) {
//.. cut alot of things out
if (viewContent == mNavContent_1_mc) {
mNavContent_1_mc.gotoAndStop("lastFrame");
//reset2();
viewContent._visible = true;
} else if (proHighlightClick) {
// this ius where proPos traces fine "pro1" but doesnt gotoandPlay the frame labeled pro1
viewContent._visible = true;
viewContent.gotoAndPlay(proPos);
}}
String Passing
I am trying to create a string on the main stage which I will use to load swf's externally into a scroll pane. Say I create a string called name (name = new String()) and when I click the button called home, name is changed to home.swf (name = "Home.swf"). The button home also loads a movie onto the main stage from the library called animation which is a nice little preloader and a couple of things flying around before I want the page to show up. Within the movie I just called onto the main stage, I include the code myScrollPane.loadScrollContent(name). How come it doesnt load Home.swf when I click the home button?
Passing A String Into A Variable Name
I have a function, and as a result of the function, I want it to create a value in a variable. The string is passed in a button as this,
on (release) {
this.boxCheck("x1");
}
function boxCheck(letter) {
if (this[letter]._currentframe == 2) {
this[letter].gotoAndStop(1);
} else if (this[letter]._currentframe == 1) {
this[letter].gotoAndStop(2);
}
HERE I WANT TO CREATE A VARIABLE THAT WOULD CONTAIN THE STRING IN IT. SO FOR THIS INSTANCE, I WANT TO CREATE A VARIABLE NAMED: x1selected = 1;
How can I do this passing the string to keep it dynamic?
like this? this[letter] + "selected" = 1;
}
Any ideas?
Passing Vars In AS3 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?
Passing String Into Flash
Hi All,
I was wondering if someone could help me out with some trouble I'm having. I've tried to find tutorials for this but it seems to be missing the what I'm looking for. I want to pass a string into flash from a php page. I know I have to have the string in the object. But I don't know how to write the code so flash can understand. I want to have the string value be entered into a text box. Any help would be great thanks..
Passing A String To A Function
Hi I want to pass a varible (a string) to a function when I roll over a
button. I have tried this but it does not work.
var ross:String('hello');
freshnLogo_mc.addEventListener(MouseEvent.ROLL_OVER, oneRollover, ross);
function oneRollover(event:MouseEvent, ross):void {
trace('you passed' + ross);
}
Passing A String To An External MC
I load my external swf....
var myRequest1:URLRequest = new URLRequest("external.swf");
myLoader1.load(myRequest1);
var _content:MovieClip = MovieClip(myLoader1.content);
stage.addChild(_content);
_content.myname ="Albert";
on the first frame of the external swf
trace("hello you" + myname);
I get an error. How Do I do this?
Thanks
Passing Data With Query String
I'm trying to 'pass-through' a variable in a flash movie.
Basically I'm using flash to create a form that needs to be posted back to a server side database, using get url this is no problem.
However I want to populate the flash movie with a value that when the get url command is exectued, this value is passed back to the database.
e.g.
I have a variable called "AdvertID" it's value is "100". I know this before I play the movie, so I call the movie thus:
embed src "movie.swf?AdvertID=100" etc.
However when flash posts this data back using get url, it doesn't appear as one of the variables.
I do not want the user to see this value (however if they must I can live with it).
Do I have to declare "AdvertID" as a variable for this to work?
If I do where?
Thanks.
Passing A Filename As A Variable..is It A String?
Hey can someone help me,
I want to set a variable as a file name,
i.e variable_1 = "file_1.exe";
How should I declare it? I was declaring it as above but it was being passed as a string and wasn't being picked up by my other functions, I also tried without the inverted commas and it wasn't being picked up at all, any advise?
Cheers
Passing String Variables To Flash
I am passing variables in a url string from an asp page to my .swf file and reading the variables into text boxes within flash.
eg.
http://www.mywebpage/pageFlash.asp?...ameVar=François
As you can see, the variable I am using contains a special french character.
Now here is the problem. On some computers the variable is passed to flash with no problem at all and on other computers the same flash file is unable to read the variable. I have tried url encoding the variable to read %E7 and also have placed System.useCodePage=true; on my first line of actionscript, but neither works.
Does anyone know why the special character works on some computers and not on others? All the computers have IE 6 and are running Windows 2000.
Passing String To Target In LoadVariables
for the loadVariables function, I have a file to be loaded. however as for the target, i have no definate target. but a string of the target will be produced in the code. but it doesnt seems to work when i put the string of the target address to the target parameter of loadVariables. how can i get it work?
thanks
[CS3] Passing Variables From Query String
Hi there,
i'm trying to pass a variable from a web page to a flash file. The flash file has a dynamic text box with the var value set to formError.
In the webpage i have the following code:
<script type="text/javascript">
var so = new SWFObject("flash/index_030308.swf?t=150", "mymovie", "938", "305", "8", "#FFFFFF");
so.addParam("allowScriptAccess", "sameDomain");
so.addParam("quality", "high");
so.addVariable("formError", "<%=request.QueryString("formError")%>");
</script>
to test i am typing in the address bar default.asp?formError=woteva, hoping to see "woteva" displayed in my dynamic text box in the flash file, but this isn't the case. Where am i going wrong?
Passing A Variable To Flash Via Url String
I understand how to get a variable into flash when it's hard coded into the html using Flashvars or this is how I do it with SWFObject:
where variable: location=subdirectory
Code:
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("featuredviewer.swf", "featuredviewer", "620", "480", "8", "#fff");
so.addVariable("location", "subdirectory");
so.write("logo");
// ]]>
</script>
What I don't understand and can't find is how to do this...
I have an html file with an swf in it. Different buttons in the file open a popup window via javascript. I want to pass a variable to the swf in the pop up window, possibly like this:
Code:
on (release) {
getURL("javascript:Launch('featuredviewer.html?position=one')");
}
But how do you extract the variable position=one out of the url and get it into flash?
Passing Class Names As A String...
Hi People,
I need to pass a class name to a function acting as a class 'instancer' (bad english, sorry)
I've tried [] and eval but no result...
one of wrong cases I've tried:
Code:
showModule = function(moduleClass:String){
var module = new eval(moduleClass)(_level0.module_container);
}
thanks
Passing Variable On Querry String To PHP
I'm building a upload app and need to send my php script some info when I call my upload script. I've established a var ID.
Can someone confirm if my syntax is correct.
ActionScript Code:
fileRef.upload("upload.php?userid='+ID+'");
Thanks!
Passing A Variable To A Query String
I am trying to create a form in Flash that passes variables to a query string. Simple enough, but when my variables have an underscore (eg variable_one) Flash coverts the underscore to “%5F”. I noticed that it seems to convert all non letter or number characters to something else. Unfortunately I don’t have the option to change the names of the variables I am passing.
This is the code:
submit.onRelease = function () {
getURL ("http://www.actionscript.org","", "GET");
};
Has anyone encountered this? Help Please!
Passing String Info Via MovieClip?
Hello.
I'll try to explain what I'm looking for, I haven't started coding yet so have nothing to show.
I have 190 movieclips which display various types of information. When a user clicks on a movieclip, it has to tween larger but also send a string to a method. I'll probably e.currentTarget to use one function which contains a tween and I wondered if there was a quick way to pass string info in a similar way?
So, each movieclip has it's own value which can be passed to a method which will use that value. The only way I can think of so far is to have 190 functions which send the string data to the appropriate place. I'm trying to avoid that if I can.
Thank you.
Passing A Query String To Flash
Here's the need:
I'm going to be making a gallery of "thumbnails" which are all a flash file dynamically loading new content in each. So a single html page will house up to 48 copies of that same swf loading a new picture in each.
There has to be a way to load a flash file with a query at the end, right (in the html source code)? Like filename.swf?id=123&thispage=123 right? If so, how do I access those variables passed to flash?
My idea was to write my standard loop (in PHP) posting a new swf in each iteration but change the query string with each so that I can load the new content.
MX : Passing Variables To Command String
I'm trying to design an interface that to simplify the construction of a string. Here's an example: My output (using the getURL command) needs to be in the form of:
http://fakesite.com:8080/java/submit...ng2=y&thing3=z
I'm able to define variables for x, y, and z, however I am unable to figure out how to substitute the defined values for those variables into the string when it is time to send it.
I may not be being very clear here, but does anyone have any ideas?
Thanks
Jeff Kirsch
Passing Variables Via Query String
i am trying to load different xml that get generated through .net when I am trying to pass varibels i am getting undefined. Can someone give me a heads up on what i might be doing wrong. from what I have read and learned I can pull via-
Code:
xmlData.load("/family/galleryimage.xml.aspx?pid=" + _root.loaderInfo.parameters.pid.toString());
Then I am defining pid in within the object class.
Code:
<param name="pid" value='<% =Request.QueryString["pid"] %>'>
However I am getting undefined. Any help is much appreciated, thanks.
MT
Trouble Passing String Var Into Function
im making a function that limmits text to a specified number...
only problem is i cant seem to pass in the text var that contains the text
any help would be awesome.
thanks in advance
ActionScript Code:
var textF1:String = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam neque purus, aliquam sed, sagittis tincidunt, adipiscing ac, urna. Ut libero urna, nonummy sodalesxxx";function TrimText(limmit:Number, area, textVar) { var lengthF1:Number = [textVar].length; trace(lengthF1); var charLimmit:Number = limmit; for (var i:Number = 0; i<=charLimmit; i++) { trace(i); if (i == 0) { textcut = [textVar].charAt(i); } else { textcut += [textVar].charAt(i); trace(textcut); if (i == charLimmit && lengthF1>=charLimmit) { textcut += "..."; _root[area].text = textcut; trace(area); } else { _root[area].text = textcut; } } }}TrimText(160,"texttest",textF1);
MX : Passing Variables To Command String
I'm trying to design an interface that to simplify the construction of a string. Here's an example: My output (using the getURL command) needs to be in the form of:
http://fakesite.com:8080/java/submit...ng2=y&thing3=z
I'm able to define variables for x, y, and z, however I am unable to figure out how to substitute the defined values for those variables into the string when it is time to send it.
I may not be being very clear here, but does anyone have any ideas?
Thanks
Jeff Kirsch
Passing Query String From Address Bar URL Into Swf
Hi All,
Let me preface this by saying that I'm primarily a design/animation/marketing guy so this could be a stupid question with an obvious answer. However, I have been scouring the web for two days now and have yet to find any posts/tutorials which offer a solution.
Here's the challenge:
I have a flash movie that movie is contained within the same included file on every page of a site. I need some way of telling the flash which pages it's on so it can display the appropriate XML feed. Since each of my pages has a query string in the URL (i.e. thesite.com?page=1) I imagine the best way to do this is to somehow send the string into the flash movie. Once it's inside the movie I'll write a function that pairs the each string with it's corresponding XML feed (btw, if anyone has an a similar script they can post it would be a huge help to me!).
Note that because the movie is part of an include that is on ever page its parameters (such as EMBED tags) cannot be changed either.
The only solution outside of directly passing the query string from the page URL (as it appears in the address bar) to the flash would be to create some sort of Javascript in the HTML that captures the query string and then sends it along.
If anyone can help me out with this it would be GREATLY APPRECIATED.
Thank you in advance!
Passing Variable From An HTML Query String
HELP?
I am using the javascript
window.document.smoothie.SetVariable("_root.texty" , query);
in an HTML page, to pass the value in 'query' to a dynamic text box, 'texty' on the main timeline of my Flash movie.
The passing of the variable works, and can be seen on any one of these 3 pages:
http://www.runspotrun.com/test/page2.html?chewbacca
http://www.runspotrun.com/test/page2.html?hansolo
http://www.runspotrun.com/test/page2.html?obiwan
If the value of query is 'chewbacca' then what loads on the page is different than if the value is 'hansolo' and so on...
The passing of this variable works, EXCEPT - one needs to RELOAD the page to see it. When the movie/page first loads, the value doesn't appear. If it is reloaded, then the value appears. A following visit to the same page, even passing a different variable will work fine also. It's just that very first visit, the first time the movie is opened on a particular browser.
After many hours of trying to figure this out, I am at a loss. Can anyone help me with this please?
ThankS!
mark
Passing Special Characters On A Query String
Hi,
I have a project that requires to send a string variable to a swf movie using a query string in html like this:
<PARAM NAME=movie VALUE= "movie.swf?text=Vous êtes dans le Hall d'entrée.">
My problem is:
this text is read from a database using jsp and has special characters like é, è, à and other french specific ch.
I've seen the posts for external txt files using unicode, tried to save the html file as unicode, but still no results. My text field doesn't look right.
Can anyone help me? I ran out of solutions.
Thank you.
Passing Query String Var Into Flash Only Works Sometimes...?
I'm trying to pass a variable into Flash from a query string, and for the most part it works great.
flashmovie.swf?page=home
On any page other than the home page, the Flash movie should skip it's build animation and go right to a resting state. Code:
if (page != "home") {
gotoAndPlay("navigation");
} else {
play();
}
This only works as intended after visiting several pages. Lets say I arrive on the home page and the movie plays through all it's animations. Fine, great. Now I go to any other page and it should skip right to the 'navigation' keyframe - right? Wrong, the movie skips ahead only about 40 frames, and plays out the rest of the intro. All other pages afterward behave correctly as coded. And revisiting that second page also now behaves normally.
What's the deal?
Passing Multiple Variables In GetURL String
Is it possible to pass multiple variables in a getURL string?
I can do this getURL("javascript:doLMSSetValue('cmi.interactions .0.student_response','"+group1.getValue()+"')
where group1.getValue()is the variable. But what what I want to do is pass something like this
var qadata = doLMSSetValue('cmi.interactions.0.id', '1');
doLMSSetValue('cmi.interactions.0.type', 'choice');
and have tried
getURL("javascript:"+qadata+); and other varieties but can't quite get that to work.
Thanks.
Passing Accented Letters Through Query String
I want to pass the variable="tést" through the query in html,
so I urlencode it and do this:
myswf?var=t%E9st
..but all I get on the flash side is a string two letters long, the second letter beeing not readable! I'm unescaping it and still nothing...
Am I missing something or flash does not accept 'ALL' urlencoded characters...
I'am just very surprised to see this....
pitu
String Parsing / Character Counting / Value Passing
hi, everyone -- i DESPERATELY need help with what is for me a pretty esoteric AS 3 task. i need to:
1.) get a string (for context purposes, a URL) from an input field;
2.) count the amount of times a certain character shows up in that string (in my case, and as above, a backslash or "/") ;
3.) after counting a specific number of instances of a character in the string -- say 4 "/"s -- the string is split up at that exact spot and the first half is sent to one parameter (say, nc.connect) + a dynamic text field, and the second half is sent to another parameter (say, ns.play) + a second dynamic text field.
i'm no coding expert under the best of circumstances, but AS 3 seems to be even tougher for me, more strongly typed, and less likely to respond to deprecated kinds of events like onRelease for buttons. i'm sure some for loop "where i<4, i++" or its like would be invoked, but trying to count the amount of characters and populate different kinds of parameters is pretty well beyond me.
thanks for any help you all might be able to provide!
A Not So Average Problem, When Passing String To Function
Hi guys! Long time reader, first time poster.
And yes i have done a search.
I'm encountering a rather decent problem with my assignment. The idea is that we have to search amazon.com and display titles etc etc.
I've accessed amazon, got my results and now am trying to strip the xml tags from the results. I've written a budget looking function (i am bo NO means an actionscript/pogramming god, so please bear with me) which takes the result of the node, finds the spot in the strong where the xml occurrs (specifically the <> brackets) and then grabs the substring in the relevant spot.
The problem (I think) is that i can't access my function. I've got my little:
operateString = xmlTrim(operateString);
^^variable^^ = ^^^ function ^^^string passed to it
and there's a couple of traces inside it, but they don't trace and the return of the function (if there really is one) is undefined.
I've uploaded the relevant code blocks to here. This is the entire .as file if required.
I have absolutely no idea what's going wrong. The only thing I can think is that maybe there's a type casting problem? Somehow?
Any help at all would be appreciated guys I should have asked this days ago, but thought that chat sites would offer a immediate solution. unfortuantely not.
Thanks for your time
Josh
Passing Variable To FLVPlayback Via Query String
This seems very easy but I am stuck here....
Here's the html that I'm trying to pass the flv name to the FLV component
Attach Code
In the html
<param name="movie" value="/proxy/MC-video-component.1.swf?flvName=vod/q1_2009_mkt_story">
and in AS i have an instance of the FLVPlayback component on the stage
var flvName;
myFLVPlayback.source = "rtmp://myFMSserver.org/" + flvName +".flv";
Any help?
Passing Variables From HTML To Flash Using Query String
Am using query strings in HTML to pass variables to my flash movie so I can use the same movie but different title on each page. See www.gogojuicebars.com
Works fine when I test locally, but when uploaded the movie seems to display only the first "welcome" title on each page until you have clicked all of them. Then it works correctly???? Is almost like the flash movie is loading before the varaibles can be passed, but how can this be??
Any ideas on how to fix this?
MX04 - Simple Function - Passing Through A String Argument
Hi there.
I have a function that is try to pass through a url to a pop up menu using Javasccript. The pop up works fine but i cant get the url parameter to pass through.
On the root of the movieclip i have:
Code:
function popUp(url : String){
var fullURL = url;
getURL("javascript:NewWindow=window.open('fullURL','myWindow','width=300,height=200,left=400,top=200,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No'); NewWindow.focus(); void(0);");
}
Then on the button i have:
Code:
on (release) {
popUp("www.msurgery.co.uk/contract.php");
}
Thanks for your time.
Trouble Loading A Text File When Passing The Variable In The URL String
I am trying to load variables into Flash from a text file. I pass the name of the text file as a variable in the URL string and then use that variable in the loadVariables command to pull in the text file. It works fine locally but is unreliable up on the server.
I seem to have got past this problem by moving the action to frame 2 from frame 1.
Has anyone else experienced problems with this and has found a better resolution?
URLRequest
o IM trying to take input text, and apply it to a URL string.
Im using URLRequest, and this is not kiking back an error,
but its also not including the zip either??
var zip:String;
var norcalhonda:URLRequest = new URLRequest("http://www.norcalhonda.com/result.php?searchzip=" + zip);
goBtn.addEventListener(MouseEvent.CLICK , getCode);
function getCode(event:MouseEvent):void
{
zip = zipInput.text;
navigateToURL(norcalhonda);
//trace(zip);
}
URLRequest Help
hey im newbie at actionscript
i was wonder do i need to have the URLRequest-action in the time line of sceen 1 for it to work?
nothing is wrong with my code cuz it works if make a new swf with the button in the middle of the stage on sceen one.
URLRequest
so Im trying to pass a URLRequest in a function that contains
both the start of the URL and the subsequent zip code for part
of the string. However URLRequest only accepts urls in quotes
so heres the code that doesnt work:
var norcalhonda:URLRequest = new URLRequest("http://www.norcalhonda.com/result.php?searchzip=" + zip.text);
var zip:String;
goBtn.addEventListener(MouseEvent.CLICK , getCode);
function getCode(event:MouseEvent):void
{
zip = zipInput.text;
navigateToURL(norcalhonda);
//trace(zip);
}
and heres the code that does work because I pulled the zip.text out of the URLRequest. I also tried putting a variable in the URLRequest and building the string there, but the URLRequest does not accept anything not in quotes, and at which point it becomes a relative path/link. someone help!
Help With URLrequest
Is there an alternative to using the URL request method, like if i have the flash object in the library could i call it in some other way, so this way the movie isn't dependent on the other flash file, instead its already in the library
Thanks this is my code im using skrol 1.0 and figuring out a few things
Code:
var skrolDefaultPath:URLRequest = new URLRequest("_comp/skrol/skrol_basic.swf");
//var skrolDefaultPath:URLRequest = new URLRequest("_comp/skrol/skrol_Basic.swf");
//var skrolDefaultPath:URLRequest = new URLRequest("_comp/skrol/skrol_classic.swf");
//var skrolDefaultPath:URLRequest = new URLRequest("_comp/skrol/skrol_classic/skrolClassicBlue.swf");
var skrolDefault:Loader = new Loader();
var mySkrol:MovieClip;
var myContent:skrolContent = new skrolContent();
skrolDefault.load(skrolDefaultPath);
var skrolMotion:Boolean = true;
function mySkrolLoad(event:Event):void {
mySkrol = skrolDefault.content as MovieClip;
addChild(mySkrol);
mySkrol.start();
mySkrol.addContentMovie(myContent);
mySkrol.setHeight(400);
mySkrol.setWidth(500);
mySkrol.setScrollMove(1);
mySkrol.setScrollWidth(10);
mySkrol.setMotion(skrolMotion);
mySkrol.refresh();
mySkrol.x = space.x + int((space.width - mySkrol.getWidth()) / 2);
mySkrol.y = space.y + int((space.height - mySkrol.getHeight()) / 2);
skrolDefault.contentLoaderInfo.removeEventListener(Event.COMPLETE, mySkrolLoad);
}
skrolDefault.contentLoaderInfo.addEventListener(Event.COMPLETE, mySkrolLoad);
stage.frameRate = 50;
stage.scaleMode = "noScale";
URLRequest
Hi
I have three swf's
a preloader.swf that loads my menu.swf and a third that
loads after a button is clicked inside menu.swf
Once the button is clicked I want the menu.swf to be replaced with my third swf.
The loader instance for menu.swf is inside my preloader.swf file.
How do I use reference 'myloader1' for use inside menu.swf?
here is the code inside preloader.swf:
var myrequest1: URLRequest= new URLRequest ("Menu.swf");
var myloader1: Loader = new Loader();
myloader1.load(myrequest1);
here is the code inside my menu.swf:
function Click3 ( e : MouseEvent ) {
mySound3.play();
myloader1.load(myrequest2);
addChild( myloader1 );
}
Any help would be appreciated!
matt
Help Wih URLRequest
linkButton.addEventListener (MouseEvent.CLICK, buttonClickHandler);
function buttonClickHandler (event:MouseEvent) :void {
navigateToURL (new URLRequest ("
URLRequest
OK, new Flash user here and I am trying to get my head around the differences between ActionScript 2.0 and 3.0
I'm trying to add an Action to an invisible button that sits on top of my animated Flash banner. I've used the following script but can't get it to work ('link' is my instance name):
function goHome (event:MouseEvent):void
{
var targetURL:URLRequest=new
URLRequest("https://www.josh.com/josh/")
;
navigateToURL(targetURL);
}
link.addEventListener(MouseEvent.CLICK, goHome);
When I check the script I don't get any error messages however when I publish it won't link. Can anyone offer any advice?
URLRequest Help
so IM trying to take input text, and apply it to a URL string.
Im using URLRequest, and this is not kiking back an error,
but its also not including the zip either??
var zip:String;
var norcalhonda:URLRequest = new URLRequest("http://www.norcalhonda.com/result.php?searchzip=" + zip);
goBtn.addEventListener(MouseEvent.CLICK , getCode);
function getCode(event:MouseEvent):void
{
zip = zipInput.text;
navigateToURL(norcalhonda);
//trace(zip);
}
URLRequest
Hey guys,
Im not sure why this is happening but i have a perfect script which works fine on its own. It executes the URLRequest and loads in an external sound.
However when i add the code to another .fla file i keep getting "Call to a possibly undefined method URLRequest".
The .fla it doesnt work on is a platform game im working on. With an external .as file with around 600 lines of code.
Ideally i'd like to import 4 songs externally and use them for each of the levels but im getting this error over and over. I even tried applying the code to the timeline but the same error occurs.
The code i am using is: -
Code:
var s:Sound = new Sound(new URLRequest("Sound.mp3"));
s.play();
Any help would be welcome.
Thanks
URLRequest Issues
I am working on a project that reads data from an online xml file that changes frequently. I an using timers to access the file (around once a minute). I get the first read successfully but the subsequent reads end up giving me the exact same data (like the request is just reading from a cache).
I looked up URLRequest http://livedocs.adobe.com/labs/flex/...RLRequest.html and URLRequest objects have a useCache property - however the flash help does not say anything about any kind of cache or useCache boolean value.
Does anyone have any idea of what I should be looking for?
Help With URLRequest Within A Loop
Hi All
I have built a little news reader in Actionscript 3. I am having a problem with assigning the url property for each news item. Being completely new to as3 i was thinking that i may be doing this all wrong so i hope somebody can help.
here is the script in quetion:
ActionScript Code:
import fl.motion.easing.*;
import flash.net.navigateToURL;
import gs.TweenLite;
var ySpacing:Number = 55;
var itemCount:Number = 0;
var pageNum:Number = 1;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, loadXML);
loader.load(new URLRequest("newsReader.php"));
function loadXML(e:Event):void
{
var xml = new XML(e.target.data);
for (var i=0;i<xml.item.length();i++) {
var newsBit:newsClip = new newsClip();
newsBit.newsHeader.htmlText = "<b>" + xml.item.newsHeader[i] + "</b>";
newsBit.newsDate.htmlText = "<b>" + xml.item.newsDate[i] + "</b>";
newsBit.newsText.htmlText = xml.item.newsText[i];
if (xml.item.newsLink[i] != "") {
var clickObj:moreInfo = new moreInfo();
clickObj.y = 43;
clickObj.x = 175;
clickObj.goToLink = new URLRequest();
clickObj.goToLink.url = xml.item.newsLink[i];
clickObj.addEventListener(MouseEvent.CLICK, loadLink);
function loadLink() {
navigateToURL(clickObj.goToLink, "_parent");
}
newsBit.addChild(clickObj);
}
newsBit.y = itemCount * ySpacing;
newsHolder.addChild(newsBit);
itemCount++
}
}
Everything works great except that no matter which clickObj you click, the URLRequest always loads the last item from the xml. I am thinking that a unique instance of the URLRequest object is not being created on each loop pass so the url parameter of the URLRequest object is being overwritten with the last value in the xml ech time around.
Can anyone shed some light on what i can do?
Thanks
pT
|