RE: [flexcoders] Re: Flex and URL variables

2006-03-06 Thread Matt Horn
If you are using a static HTML page to serve up the SWF file, then you
need to manually specify the params as flashVars variables in the
wrapper. For example, to pass the name Nick Danger you might do this:

object classid='clsid:D27CDB6E-AE6D-11cf-96B8-44455354'
codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflas
h.cab#version=9,0,0,0' width='500' height='500'
param name='flashVars' value='firstname=Nicklastname=Danger'
param name='src' value='FlashVarsValues.mxml.swf'
embed
pluginspage='http://www.macromedia.com/go/getflashplayer' width='500'
height='500' 
flashVars='firstname=Nicklastname=Danger'
src='FlashVarsValues.mxml.swf'/
/object

If you are using something like JSP to serve up the SWF file, then you
can use expressions to set the values of the flashVars in the wrapper:

%
String fName = (String) request.getParameter(firstname);
String lName = (String) request.getParameter(lastname);
%
...
object classid='clsid:D27CDB6E-AE6D-11cf-96B8-44455354'
codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflas
h.cab#version=9,0,0,0' width='500' height='500'
param name='flashVars' value='firstname=%= fName
%lastname=%= lName %'
param name='src' value='FlashVarsValues.mxml.swf'
embed
pluginspage='http://www.macromedia.com/go/getflashplayer' width='500'
height='500' 
flashVars='firstname=%= fName %lastname=%= lName %'
src='FlashVarsValues.mxml.swf'/
/object

If you have the FDS server, then query string params are converted to
flashVars for you.

Hth,

Matthew J. Horn
Flex docs


 -Original Message-
 From: flexcoders@yahoogroups.com 
 [mailto:[EMAIL PROTECTED] On Behalf Of yaagcur
 Sent: Sunday, March 05, 2006 1:39 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: Flex and URL variables
 
 http://livedocs.macromedia.com/flex/20beta1/docs/1300.html
 
  covers this topic
 However, although it works if you pass the URL as a .swf, if 
 you try .html (which is presumably what you want) then it 
 fails Hope someone can explain how to do this in Flex 2.0 as 
 it would be a great feature
 
 Andy Clark
 
 --- In flexcoders@yahoogroups.com, Gordon Smith [EMAIL PROTECTED] wrote:
 
  In Flex 2, the Application instance has a parameters property with 
  name/value pairs for the URL parameters and FlashVars.
  
   
  
  So in an Application script you would just access parameters.number 
  and it would be 3.
  
   
  
  From other scripts, you would use
  Application.application.parameters.number.
  
   
  
  - Gordon
  
   
  
  
  
  From: flexcoders@yahoogroups.com 
 [mailto:[EMAIL PROTECTED] 
  On Behalf Of JesterXL
  Sent: Thursday, March 02, 2006 2:55 PM
  To: flexcoders@yahoogroups.com
  Subject: Re: [flexcoders] Flex and URL variables
  
   
  
  Flex 1.5 or 2?
  
   
  
  - Original Message -
  
  From: Jonathan Miranda mailto:[EMAIL PROTECTED]
  
  To: flexcoders@yahoogroups.com
  
  Sent: Thursday, March 02, 2006 5:49 PM
  
  Subject: [flexcoders] Flex and URL variables
  
   
  
  Alright, I've done this with Flash before but I'm wondering how 
  similar it is.
  
  Let's say I start my app @ http://mysite.com/index.mxml?number=3
  
  What's the easiest way to get that 3 into a variable in Flex? Using 
  FlashVars in the embed/object tags and then somehow do 
  mx.core.application.Application.number as my variable?
  
  _
  
  Jonathan Miranda
  
  Flexible Master of the Web
  
  Try not to become a man of success, but a man of value. - Albert 
  Einstein
  
  HealthGrades http://www.healthgrades.com/ : Guiding America to 
  Better
  Healthcare(tm)
  
  NASDAQ: HGRD
  
  w  (720) 963-3832
  
  c  (707) 761-0868
  
  [EMAIL PROTECTED] 
  
  _
  
  The message contains confidential and/or legally privileged 
  information and is intended for use only by the indicated 
 addressee.  
  If you are not the named addressee you should not disseminate, 
  distribute, or copy this e-mail. Please notify the sender 
 immediately 
  by e-mail if you have received this e-mail by mistake and 
 delete this e-mail from your system.
  E-mail transmissions cannot be guaranteed to be secure or 
 error-free 
  as information could be intercepted, corrupted, lost, 
 destroyed,arrive 
  late or incomplete, or contain viruses. The sender 
 therefore does not 
  accept liability for any errors or omissions in the 
 contents of this 
  message which arise as a result of e-mail transmission. If 
  verification is required please request a hard-copy version.
  
   
  
  
  
  --
  Flexcoders Mailing List
  FAQ: 
 http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Search Archives:
  http://www.mail-archive.com/flexcoders%40yahoogroups.com
  
  
  
  
  SPONSORED LINKS
  
  Web site design development
  
 http://groups.yahoo.com

[flexcoders] Re: Flex and URL variables

2006-03-05 Thread yaagcur
http://livedocs.macromedia.com/flex/20beta1/docs/1300.html

 covers this topic
However, although it works if you pass the URL as a .swf, if you try
.html (which is presumably what you want) then it fails
Hope someone can explain how to do this in Flex 2.0 as it would be 
a great feature

Andy Clark

--- In flexcoders@yahoogroups.com, Gordon Smith [EMAIL PROTECTED] wrote:

 In Flex 2, the Application instance has a parameters property with
 name/value pairs for the URL parameters and FlashVars.
 
  
 
 So in an Application script you would just access parameters.number and
 it would be 3.
 
  
 
 From other scripts, you would use
 Application.application.parameters.number.
 
  
 
 - Gordon
 
  
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of JesterXL
 Sent: Thursday, March 02, 2006 2:55 PM
 To: flexcoders@yahoogroups.com
 Subject: Re: [flexcoders] Flex and URL variables
 
  
 
 Flex 1.5 or 2?
 
  
 
 - Original Message - 
 
 From: Jonathan Miranda mailto:[EMAIL PROTECTED]  
 
 To: flexcoders@yahoogroups.com 
 
 Sent: Thursday, March 02, 2006 5:49 PM
 
 Subject: [flexcoders] Flex and URL variables
 
  
 
 Alright, I've done this with Flash before but I'm wondering how similar
 it is.
 
 Let's say I start my app @ http://mysite.com/index.mxml?number=3
 
 What's the easiest way to get that 3 into a variable in Flex? Using
 FlashVars in the embed/object tags and then somehow do
 mx.core.application.Application.number as my variable?
 
 _
 
 Jonathan Miranda
 
 Flexible Master of the Web
 
 Try not to become a man of success, but a man of value. - Albert
 Einstein
 
 HealthGrades http://www.healthgrades.com/ : Guiding America to Better
 Healthcare(tm)
 
 NASDAQ: HGRD
 
 w  (720) 963-3832
 
 c  (707) 761-0868
 
 [EMAIL PROTECTED] 
 
 _
 
 The message contains confidential and/or legally privileged information
 and is intended for use only by the indicated addressee.  If you are not
 the named addressee you should not disseminate, distribute, or copy this
 e-mail. Please notify the sender immediately by e-mail if you have
 received this e-mail by mistake and delete this e-mail from your system.
 E-mail transmissions cannot be guaranteed to be secure or error-free as
 information could be intercepted, corrupted, lost, destroyed,arrive late
 or incomplete, or contain viruses. The sender therefore does not accept
 liability for any errors or omissions in the contents of this message
 which arise as a result of e-mail transmission. If verification is
 required please request a hard-copy version.
 
  
 
 
 
 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.com 
 
 
 
 
 SPONSORED LINKS 
 
 Web site design development
 http://groups.yahoo.com/gads?t=msk=Web+site+design+developmentw1=Web+
 site+design+developmentw2=Computer+software+developmentw3=Software+des
 ign+and+developmentw4=Macromedia+flexw5=Software+development+best+prac
 ticec=5s=166.sig=L-4QTvxB_quFDtMyhrQaHQ  
 
 Computer software development
 http://groups.yahoo.com/gads?t=msk=Computer+software+developmentw1=We
 b+site+design+developmentw2=Computer+software+developmentw3=Software+d
 esign+and+developmentw4=Macromedia+flexw5=Software+development+best+pr
 acticec=5s=166.sig=lvQjSRfQDfWudJSe1lLjHw  
 
 Software design and development
 http://groups.yahoo.com/gads?t=msk=Software+design+and+developmentw1=
 Web+site+design+developmentw2=Computer+software+developmentw3=Software
 +design+and+developmentw4=Macromedia+flexw5=Software+development+best+
 practicec=5s=166.sig=1pMBCdo3DsJbuU9AEmO1oQ  
 
 Macromedia flex
 http://groups.yahoo.com/gads?t=msk=Macromedia+flexw1=Web+site+design+
 developmentw2=Computer+software+developmentw3=Software+design+and+deve
 lopmentw4=Macromedia+flexw5=Software+development+best+practicec=5s=1
 66.sig=OO6nPIrz7_EpZI36cYzBjw  
 
 Software development best practice
 http://groups.yahoo.com/gads?t=msk=Software+development+best+practice;
 w1=Web+site+design+developmentw2=Computer+software+developmentw3=Softw
 are+design+and+developmentw4=Macromedia+flexw5=Software+development+be
 st+practicec=5s=166.sig=f89quyyulIDsnABLD6IXIw  
 
  
 
  
 
 
 
 YAHOO! GROUPS LINKS 
 
  
 
 *  Visit your group flexcoders
 http://groups.yahoo.com/group/flexcoders  on the web.
 
 *  To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] 
 
 *  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
 Service http://docs.yahoo.com/info/terms/ . 
 
  
 
 






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

Re: [flexcoders] Re: Flex and URL variables

2006-03-05 Thread Abdul Qabiz



You mean, if you try to pass variables to a html page that embeds the SWF?http://myserver/myflexapp.html?foo=barI think, then you can use _javascript_ to extract query-string variables and pass it to SWF using ExternalInterface or using flashvars (if your embedding SWF using JS itself).
-abdulOn 3/6/06, yaagcur [EMAIL PROTECTED] wrote:
http://livedocs.macromedia.com/flex/20beta1/docs/1300.html covers this topicHowever, although it works if you pass the URL as a .swf, if you try
.html (which is presumably what you want) then it failsHope someone can explain how to do this in Flex 2.0 as it would bea great featureAndy Clark--- In 
flexcoders@yahoogroups.com, Gordon Smith [EMAIL PROTECTED] wrote: In Flex 2, the Application instance has a parameters property with name/value pairs for the URL parameters and FlashVars.
 So in an Application script you would just access parameters.number and it would be 3. From other scripts, you would use Application.application.parameters.number
. - Gordon  From: flexcoders@yahoogroups.com [mailto:
flexcoders@yahoogroups.com] On Behalf Of JesterXL Sent: Thursday, March 02, 2006 2:55 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Flex and URL variables
 Flex 1.5 or 2? - Original Message - From: Jonathan Miranda mailto:jmiranda@... To: 
flexcoders@yahoogroups.com Sent: Thursday, March 02, 2006 5:49 PM Subject: [flexcoders] Flex and URL variables Alright, I've done this with Flash before but I'm wondering how similar
 it is. Let's say I start my app @ http://mysite.com/index.mxml?number=3 What's the easiest way to get that 3 into a variable in Flex? Using
 FlashVars in the embed/object tags and then somehow do mx.core.application.Application.number as my variable? _ Jonathan Miranda
 Flexible Master of the Web Try not to become a man of success, but a man of value. - Albert Einstein HealthGrades 
http://www.healthgrades.com/ : Guiding America to Better Healthcare(tm) NASDAQ: HGRD w(720) 963-3832 c(707) 761-0868 [EMAIL PROTECTED]
 _ The message contains confidential and/or legally privileged information and is intended for use only by the indicated addressee.If you are not
 the named addressee you should not disseminate, distribute, or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.
 E-mail transmissions cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed,arrive late or incomplete, or contain viruses. The sender therefore does not accept
 liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version.
 -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS
 Web site design development http://groups.yahoo.com/gads?t=msk=Web+site+design+developmentw1=Web+
 site+design+developmentw2=Computer+software+developmentw3=Software+des ign+and+developmentw4=Macromedia+flexw5=Software+development+best+prac ticec=5s=166.sig=L-4QTvxB_quFDtMyhrQaHQ
 Computer software development http://groups.yahoo.com/gads?t=msk=Computer+software+developmentw1=We
 b+site+design+developmentw2=Computer+software+developmentw3=Software+d esign+and+developmentw4=Macromedia+flexw5=Software+development+best+pr acticec=5s=166.sig=lvQjSRfQDfWudJSe1lLjHw
 Software design and development http://groups.yahoo.com/gads?t=msk=Software+design+and+developmentw1=
 Web+site+design+developmentw2=Computer+software+developmentw3=Software +design+and+developmentw4=Macromedia+flexw5=Software+development+best+ practicec=5s=166.sig=1pMBCdo3DsJbuU9AEmO1oQ
 Macromedia flex http://groups.yahoo.com/gads?t=msk=Macromedia+flexw1=Web+site+design+
 developmentw2=Computer+software+developmentw3=Software+design+and+deve lopmentw4=Macromedia+flexw5=Software+development+best+practicec=5s=1 66.sig=OO6nPIrz7_EpZI36cYzBjw
 Software development best practice http://groups.yahoo.com/gads?t=msk=Software+development+best+practice
 w1=Web+site+design+developmentw2=Computer+software+developmentw3=Softw are+design+and+developmentw4=Macromedia+flexw5=Software+development+be st+practicec=5s=166.sig=f89quyyulIDsnABLD6IXIw
  YAHOO! GROUPS LINKS *Visit your group flexcoders 
http://groups.yahoo.com/group/flexcoders  on the web. *To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]?subject=Unsubscribe *Your use of Yahoo! Groups is subject to the Yahoo! Terms of
 Service http://docs.yahoo.com/info/terms/ . --Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txtSearch Archives: 
http

Re: [flexcoders] Re: Flex and URL variables

2006-03-05 Thread Abdul Qabiz



Oops! there are few errors in code I sent. I forgot to remove exteds Proxy from QueryString class.Please hold on, I would send another mail in a while.-abdul
On 3/6/06, Abdul Qabiz [EMAIL PROTECTED] wrote:
Hi,I wrote a somple QueryString class in AS3, that would get you parameters passed to HTML wrapper.Usage is simple:Suppose url is: 
http://server/page.html?param1=10
AS code:import com.abdulqabiz.utils.QueryString;function onAppInit(){var qs:QueryString = new QueryString();trace(qs.param1);}
Please find the attached zip file. Or see code below:-

##QueryStringSample.html - HTML Wrapper##

html
 head
  titleQuery String Sample/title
  
 /head
 body

 !-- Using FlashObject from http://blog.deconcept.com/flashobject/ --
 script type=text/_javascript_ src="">
 div id=flashcontent
   This text is replaced by the Flash movie.
 /div

 script type=text/_javascript_
  var fo = new FlashObject(QueryStringSample.swf,mymovie, 100%, 100%, 8.5, #336699);
  fo.write(flashcontent);
 /script
  
 /body
/html##QueryStringSample.mxml - Sample MXML using Class##mx:Application xmlns:mx=
http://www.macromedia.com/2005/mxml creationComplete=initVars()
 mx:Script![CDATA[ import com.abdulqabiz.utils.QueryString; // Declare bindable properties in Application scope. [Bindable] public var myName:String;
 [Bindable]
 public var myHometown:String;  private var qs:QueryString; // Assign values to new properties. private function initVars():void {  qs = new QueryString();

 name_lbl.text = qs.parameters.myName; homeTown_lbl.text = qs.parameters.myHomeTown; } ]]/mx:Script  mx:VBox mx:HBox mx:Label text=Name: /
 mx:Label id=name_lbl fontWeight=bold/ /mx:HBox mx:HBox mx:Label text=Hometown: / mx:Label id=homeTown_lbl fontWeight=bold/
 /mx:HBox /mx:VBox/mx:Application##QueryString.as - The class##

package com.abdulqabiz.utils 
{
 import flash.external.*;
 import flash.util.trace;

 public class QueryString extends Proxy
 {

  private var __queryString:String;
  private var __all:String;
  private var __params:Object;
  
  public function get queryString():String
  {
   return __queryString;
  }
  public function get url():String
  {
   return __all;
  }
  public function get parameters():Object
  {
   return __params;
  }  

  
  public function QueryString()
  {
  
   readQueryString();
  }

  private function readQueryString():void
  {
   __params = {};
   try 
   {
_url = ExternalInterface.call(window.location);
_queryString = ExternalInterface.call(window.location.search.substring, 1);
//trace(_queryString);
if(_queryString)
{

 var params:Array = _queryString.split('');
 var length:uint = params.length;
 
 for (var i:uint=0,index:int=-1; ilength; i++) 
 {
  var kvPair:String = params[i];
  if((index = kvPair.indexOf(=))  0)
  {
   var key:String = kvPair.substring(0,index);
   var value:String = kvPair.substring(index+1);
   __params[key] = value;
  }
 }
}
   }catch(e:Error) { trace(Some error occured. ExternalInterface doesn't work in Standalone player.); }
  }

 }
}
This is quick and dirty code. I initialyl wrote the entire class using Proxy, so that you can access properties over it (but data is stored in a variable inside the class). But for simplicity I removed things...

Things, that are not done:* Detect if some variables are passed via FlashVars also and merge parameters* Error handling* Testing in different browsers and under different security sandbox cases.

These can be done easily...So I am not doing it :)-abdul
On 3/6/06, Abdul Qabiz [EMAIL PROTECTED]
 wrote:You mean, if you try to pass variables to a html page that embeds the SWF?
http://myserver/myflexapp.html?foo=barI think, then you can use _javascript_ to extract query-string variables and pass it to SWF using ExternalInterface or using flashvars (if your embedding SWF using JS itself).
-abdulOn 3/6/06, 
yaagcur [EMAIL PROTECTED] wrote:


http://livedocs.macromedia.com/flex/20beta1/docs/1300.html covers this topic
However, although it works if you pass the URL as a .swf, if you try
.html (which is presumably what you want) then it failsHope someone can explain how to do this in Flex 2.0 as it would bea great featureAndy Clark--- In 


flexcoders@yahoogroups.com, Gordon Smith [EMAIL PROTECTED] wrote: In Flex 2, the Application instance has a parameters property with name/value pairs for the URL parameters and FlashVars.
 So in an Application script you would just access parameters.number and it would be 3. From other scripts, you would use Application.application.parameters.number


. - Gordon  From: 

flexcoders@yahoogroups.com [mailto:
flexcoders@yahoogroups.com] On Behalf Of JesterXL Sent: Thursday, March 02, 2006 2:55 PM To: 

flexcoders@yahoogroups.com Subject: Re: [flexcoders] Flex and URL variables
 Flex 1.5 or 2? - Original Message - From: Jonathan Miranda mailto:

jmiranda@... To: 
flexcoders@yahoogroups.com Sent: Thurs