[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

FlashVars Help - ActionScript 3.0

Posted on 2007-08-09
3
Medium Priority
?
4,128 Views
Last Modified: 2008-06-09
I am trying to load FLV files using FlashVars "file=rmpt://path_to_flv_file.flv" using ActionScript 3.0. I was following a tutorial http://reallyshiny.com/tutorials/flash.php but apparently this is for AS 2.0 and getting FlashVars informaion is not as simple as var=var anymore in AS 3.0.  anyways, question is:

Can someone help me dynamically load an FLV file into my FLV player with FlashVars ebmedded into the HTML of the page? What do I need to place in my FLA file to set the source of the FLV as my FlashVar variable?

Thanks!!!!
0
Comment
Question by:makman24
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
MacSims earned 1500 total points
ID: 19677556
FlashVars and querystring vars are still there, they have just been moved in AS3 (like many other things.)

In AS3 they can now be found in a generic object located at this.loaderInfo.parameters off the main timeline, or this.root.loaderInfo.parameters from elsewhere.

(It's best practice to typecast loaderinfo like: LoaderInfo(this.root.loaderInfo).parameters)

So if you have querystring vars like:

var1=bob&var2=jane

then the parameters object would look like:

parameters.var1 == "bob"
parameters.var2 == "jane"

You can read more in depth explanation and code samples here:

http://blogs.adobe.com/pdehaan/2006/07/using_flashvars_with_actionscr.html


Mac
0
 

Author Comment

by:makman24
ID: 19679472
This helps at a glance, but my question was "What do I need to place in my FLA file to set the source of the FLV as my FlashVar variable?" In other words, what is the exact AS code I would need to put into the first frame of the movie to assign the "file" var's contents to the player's source parameter.

-MAK
0
 

Author Comment

by:makman24
ID: 19687066
Well, I figured it out myself. Was hoping for a quick help, but that's ok.

You pass variables through FlashVars to the SWF and retrieve them by simply typing:

root.loaderInfo.parameters.myFlashVar; Where "myFlashVar is the FlashVar passed. In my case, I wanted to dynamically load an FLV file from my php page and call the FLV based on user input. thus i placed:

player.source = root.loaderInfo.parameters.file;

on the first frame of my FVLPlayer movie. Where player is the instance name of the FLVPlayback Object and "file" is the FlashVar passed. I am dynamically setting the source of the FLV file. Works like a charm!

-MAK
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question