Loading php variables into flash 8
i'm trying to load some vars into flash 8. i tried
loadvariables, loadvariablesnum, loadvars, google. can't figure it
out.
2 years ago when using flash mx trying the same thing, the
line:
loadVariablesNum("file",0);
was enough to do the trick.
but in flash 8 can't get it to work ;(
i have the simplest php file, something like this:
<?
$town = "where";
$person = "who";
$sex = "male";
print "town=$town&person=$person&sex=$sex";
?>
the use of variables is a must, so the solution
print "town=where&person=who&sex=male"
doesn't do me any good. actually this works.
so what's the correct way of loading this into flash 8?
thanks guyz.
you can also use a FlashVars= parameter in your
<object><embed> code, IF you are using your PHP code to
also display your flash movie, and if you only need to pass these
variables once when the movie loads. If this is what you need to
do, use this....
<object ...>
....// other params .....
<param name="FlashVars" value="<?
echo var1name;
?>=<?
echo var1value;
?>&<?
echo var2name;
?>=<?
echo var2value;
?>" >
Though you will have to do that in two places, once in the
object code, and once in the embed code.
The embed code would look more like
<embed ...... FlashVars="<? //php similar to above
?>" ..... />
I have used this successfully to pass in variables when the
flash movie first loads, to pass in stuff like a URL for a link and
other info. There are a lot of different ways to pass values in to
flash. You can also use ExternalInterface.call and use Javascript
along with PHP to retrieve info at any time, but that is more
complex.
This may not be what you need - but you can still use
LoadVariables with Flash 8, as well.
Similar Messages
-
Send variable into flash macromedia
Hi,
I would send a variable into flash macromedia.
I explain my problem. I created an flash wherein i send a word into a variable called lol and i read this varibale in a other variable called dis.
But in labview i dont know how i can send this word into lol and read into dis.
I did many research and i made a .vi who could be functional.
can you help me to see where is my error in this .VI.
Thanks.
Solved!
Go to Solution.
Attachments:
flash and prog.zip 40 KBHi danylolo,
You could use a web service between Flash and LabVIEW to pass your data? You'll certainly have to develop an adapter for Flash.
Romain P.
National Instruments France
#adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
>> NIDays 2011, le mardi 8 février au CNIT de Paris La Défense -
Load external jpeg into flash movie
Hi, how do i load external jpeg into flash movie?
Can someone show me the actionscript? Thankshi, i pasted the code on a mc but it didn't work.
However, when i put in on frame action, it works.
However, i realised the image flickered (more like refreshed)
after afew sec...
Is this normal? Is it the loop problem? how do i get rid of
that? -
Unable to load php file into native window..
Hi Guys,
Im using flash cs3 as my development environment. what i was trying to do is creating a small login application using Air. I must say im still a newbie to flash air. as far as my login system concern i have managed following tasks,
1. send username ans password using post and validate through php
2. get the result back to flash application and open up a new native air window if the login is success.
3. close the login window.
now what i want to do is load my PHP application inside that newly open native window. How can i do it. I tried using Loader() method but it only worked for images not for php or html files.
heres how I tried to use the loader method,
var url:String = "http://localhost/Flash/login/welcome.php";
var fileLoader:Loader = new Loader();
fileLoader.load(new URLRequest(url));
win.stage.addChild(fileLoader);
This failed.
Does anyone know how to load a PHP file into a Native window? Your help highly appreciate it.
Just in case for the people who wants to know who I did the above mentioned tasks heres the code,
Posting data to PHP server
function sendLoginData() {
if(txtUserName.text=='')
txtBox.text = 'Username is empty';
else if(txtPassword.text=='')
txtBox.text = 'Password is empty';
else
var variables:URLVariables = new URLVariables();
variables.UserName = txtUserName.text;
variables.Password = txtPassword.text;
var request:URLRequest = new URLRequest("http://localhost/Flash/login/login.php");
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.TEXT;
request.data = variables;
request.method = URLRequestMethod.POST;
loader.addEventListener(Event.COMPLETE, handleComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
loader.load(request);
Handdle the returned data
function handleComplete(event:Event):void
var variables:URLVariables = new URLVariables(event.target.data);
if(variables.errorcode==0)
var url:String = "http://localhost/Flash/login/welcome.php";
try {
//Native window
var options:NativeWindowInitOptions = new NativeWindowInitOptions();
options.systemChrome = NativeWindowSystemChrome.STANDARD;
options.transparent = false;
options.maximizable=false;
var win:NativeWindow = new NativeWindow(options);
win.title = 'welcome page';
//win.width = 900;
//win.height = 900;
/*var fileLoader:Loader = new Loader();
fileLoader.load(new URLRequest(url));
win.stage.addChild(fileLoader);*/
win.maximize();
win.activate();
stage.nativeWindow.close();
} catch (e:Error) {
trace("Error occurred!");
else
txtBox.text = 'Invalid logins';
function onIOError(event:IOErrorEvent):void
trace("Error loading URL.");
PHP code
<?php
$username = addslashes($_POST['UserName']);
$password = addslashes($_POST['Password']);
//do your database checking here. this is an example
if($username=='niroshan' && $password=='123456')
echo "errorcode=0";
else
echo "errorcode=1";
?>
Call the function when pressing the submit
cmdButton.addEventListener(MouseEvent.CLICK,readySendLoginData);
function readySendLoginData(evt:MouseEvent){
sendLoginData();
Thanks,
best regards,
NiroshanThats right, HTMLLoader should solve the issue as Loader used for JPEG, PNG OR GIF files loading as per my knowledge
-
Bringing php data into flash file
I've got a php file, below is the code from it:
<?php
$dir = "photos/";
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
$fileList = "";
while (($file = readdir($dh)) !== false) {
if ($file != "." && $file != "..") {
If ($fileList == "") {
$fileList = $file;
else
$fileList = $fileList . ", " . $file;
echo "&newVar=$fileList";
closedir($dh);
?>
it returns a full list of files in a specified directory on
the server.
I need to pass that data into flash, so that it can build an
array, and do
other things with it.
i can use:
loadVariables("filename.php", "");
and then create a text box with the variable value of
"newVar" and it will
display the file list, but I can't seem to get that string
into a workable
variable that i can do things to it.
could someone point me to how to do this, or let me know if
you need more
info on it.
thanks.I'm able to get the list into flash as it's currently
written, but I can
only get it to display in a text box instead of haveing it in
a format that
i can do things go.
fileListArray = fileList.split(",");
I've been using this code to split the php's return into an
array of the
file names. I just can't seem to get it to work with the
loadvars/loadvariables stuff.
for example, the below code works perfectly:
var fileList:String;
var fileListArray:Array;
fileList = "01.jpg,02.jpg,03.jpg,04.jpg,05.jpg,06.jpg";
fileListArray = fileList.split(",");
when i try to display fileListArray[2] as the above code is
written, it
displays the correct .jpg file name. i just can't seem to
find a way to get
the php's return to work the same way.
"DMennenoh **AdobeCommunityExpert**"
<[email protected]> wrote in
message news:f0amga$ldh$[email protected]..
> You're close, but you don't want to return all the files
in one variable -
> return them all as something like file1 - filen. Then
you can iterate file
> in your onLoad.
>
> Change your PHP like so:
>
> <?PHP
> $dir="photos/";
>
> // Open a known directory, and proceed to read its
contents
> if (is_dir($dir)) {
> if ($dh = opendir($dir)) {
> $ind = 1;
> $fileList = "";
> while (($file = readdir($dh)) !== false) {
> if ($file != "." && $file != "..") {
> $fileList .= "&file$ind=".$file;
> $ind++;
> }
> }
> echo($fileList);
> closedir($dh);
> }
> }
> ?>
>
>
> Now, in your onLoad function you can do like so:
>
> myLoader.onLoad = function(success){
> var ind = 1;
> while(this['file' + ind]){
> trace(this['file' + ind]);
> ind++;
> }
> }
>
> Of course, you can then stick the files into an array...
>
>
> HTH
>
> --
> Dave -
> Head Developer
>
http://www.blurredistinction.com
> Adobe Community Expert
>
http://www.adobe.com/communities/experts/
> -
Loading purchased swf into Flash Builder 4 Flex app
I have purchased a Flash "fundraising thermometer" from an online Flash components site. It takes input from an xml file and displays a thermometer with the goal at the top and the current amount raised indicated. It came with the following files:
thermometer.swf
thermometer01.fla
thermometer01.html (A sample that works.)
xml/thermometer.xml (The source file: goal amount, current amount, mark interval, etc.)
caurina/transitions (Mostly .as files.)
Since the test html (thermometer01.html) works fine, I thought this would be a no-brainer.
I first unzipped the files into a "thermometer" folder in my current project. I then went into Flash Builder and created a SWFLoader object as follows:
<mx:SWFLoader
id="myLoader" source="../thermometer/thermometer.swf" complete="initThermometer();" autoLoad="true" scaleContent="false"/>\
private function initThermometer():void {
Alert.show('Thermometer loaded');
The Design view looks fine. I can see the thermometer default image (see below).
When I run the app, I get no errors, just a broken image link in a box (see below). The alert box also never shows up.
I'm new to Flex, so I may be doing something stupid that keeps this from working. I contacted the author of the thermometer widget but he doesn't know anything about Flex.
Any help figuring out how to get this to work in a flex app would be appreciated.You should probably add more event handlers to see what's going on. Especially "ioError". The complete list is below. For coverage, add a handler for each event. You can also use in MXML
complete="initThermometer(event)
and add an argument to your Actionscript method, to find out details about the event.
private function initThermometer(event:Event):void {
Alert.show('Thermometer loaded ' + event.type);}
Events
complete="No default"
httpStatus="No default"
init="No default"
ioError="No default"
open="No default"
progress="No default"
securityError="No default"
unload="No default
General info here:
http://livedocs.adobe.com/flex/3/langref/mx/controls/SWFLoader.html
I did not test my code suggestions, but it's probably close. -
Other problems with loading Captivate files into Flash AS3 project
I have a Captivate file done with Captivate 3, published to
Flash player 9 that is being loaded into Flash AS3. The captivate
is a simple recording of some mouse clicks in a browser. I am
displaying the playbar along the bottom, and its buttons all work
fine except for the progress bar, where you can drag the knob and
scrub back & forth in your presentation.
This progress bar is not working as it should. I see the
mouse cursor change to a hand, but when I click I cannot drag the
knob to control the progress bar. The other buttons in the playbar
do work (replay, pause, play, back, forward).
This is a unique problem in that it is only happening when
viewed in IE (7) when loaded into my Flash AS3 project. When viewed
in Firefox in my project, or as a standalone SWF, or as a SWF
simply embedded onto a plain HTML page, it works just fine.
Does anybody have any insight?
Another thing I notice with loading Captivate files with AS3
is the the amount of output messages it displays. Rather annoying
(unless this is a "feature" I've yet to be aware of - heh)Hi,
I know exactly how you feel, there is simple answer; replace
Captivate for Camtasia Studio 5 at techsmith.com. The weight on
those shoulders will be gone! You'll smile more, be more
socialable. One Happy Person.
I am very happy person ;)
Kind Regards,
Boxing Boom -
Variables into flash movie - Urgent help needed, please
I am hoping this is simple:
Here is my HTML code:
<param name="movie" value="orig2.swf" /><param
name=FlashVars VALUE="sname=video1.flv"><param name="quality"
value="high" /><param name="bgcolor" value="#ffffff" />
I need to pass video1.flv to the flash movie.
Here is the MOVIE data. I was told this is how to do it, but
I am sure it's missing something basic.
//insert sample link below
mediaDisplay.directLink = "
http://flash.xxx.com/flashgen.cgi?sname=&aname=xxxxxxxx/_definst_";
//pulls sname from param value in HTML
mediaDisplay.simplePlaylist = sname;
streamnameTxt.text = sname;
So, it should pull the SNAME variable from HTML and feed it
into player. If I type in SNAME variable and manually place it in
DirectLink line above, it works, but I need it to feed from HTML.
PLEASE HELP!!I know how to pass the variable TO flash, but how do I get
the FLASH movie to receive it??
Again, here is the code in the FLA file
//insert sample link below
mediaDisplay.directLink = "
http://flash.xxx.com/flashgen.cgi?sname=&aname=xxxxxxxx/_definst_";
//pulls sname from param value in HTML
mediaDisplay.simplePlaylist = sname;
streamnameTxt.text = sname; -
Loading XML Variables to Flash
I have my XML data loading into my SWF OK.
However, is there any way to call that tag name instead of
the child node number?
So instead of something like this:
myDate_txt.text = my_xml.firstChild.childNodes[2];
Can do something like this?
myDate_txt.text = my_xml.firstChild.myDate;
Is that possible? I know that does not work the way it is
written, but is there code that you can do something like that?
And how do you call the next child (cousin) if you have an
XML document like this:
<people>
<friend>
<name>Bob</name>
<age>39</age>
</friend>
<cousin>
<name>Sally</name>
<age>29</age>
</cousin>
</people>Hi
Read the Flash Help article related to the XPath API Class,
and your XML Parsing will be much easier.
Or go
here
Hope it helps -
Sending php variables to Flash Builder
Hi guys,
I have made a form which when sent to a Mysql server adds a table to a database.
Here is the code that I use in Flash Builder:
<mx:HTTPService id="srv" url="http://mysite.com/addTeam.php" method="POST">
<mx:request>
<teamName>{teamName.text}</teamName>
<city>{city.text}</city>
</mx:request>
</mx:HTTPService>
...<mx:Form x="25" y="10">
<mx:FormHeading label="Add a team"/>
<mx:FormItem label="Team name">
<s:TextInput id="teamName"/>
</mx:FormItem>
<mx:FormItem label="City">
<s:TextInput id="city"/>
</mx:FormItem>
<mx:FormItem>
<s:Button label="Add" click="srv.send()"/>
</mx:FormItem>
And here is my addTeam.php file:
<?php
$teamName = $_POST['teamName'];
$city = $_POST['city'];
$addteam = $teamName ." ". $city;
$connection = mysqli_connect("host", "username", "password", "db") or die(mysqli_connect_error());
mysqli_query($connection, "SET CHARACTER SET utf8"); //the added table will be in bulgarian language
$sql = "CREATE TABLE `$addteam`
FirstName varchar(20),
SurName varchar(20),
LastName varchar(20),
position varchar(20),
price int
mysqli_query($connection, $sql) or die ("Query failed: " . mysqli_error($connection));
?>
My question is: How can I return some text to Flash Builder if the query was successful or failed (like "echo") so that the user (admin in this case) knows what is going on and not just clicking the add button and having to go to phpmyadmin to see if the table has been created or not?You have this declared
<mx:HTTPService
id="srv" url="http://mysite.com/addTeam.php" method="POST">
just add
result="yourResultHandler()"/>
then create the function that would handle the result.
<mx:HTTPService
id="srv" url="http://mysite.com/addTeam.php" method="POST" result="yourResultHandler(event)"> -
Pass Variables into Flash from URL
I have a real simple request for some reason cannot pull it
off. I have a url that looks like this:
http://mywebserver/directory1/directory2/webpage.html?name=Mark
I am trying to pull the variable "mark" into a swf. The URL
will change depedning on the user and I plan on adding additional
variables as well (lastname, state, age, etc).
Easy answer to this? If so, please excuse my ignorance. I use
actionscript 2 but would consider myelf a novice as I am more into
design.Using FlashVars would work, as would SWFObject - which is
what I'd use. Glad
yout got it though.
Dave -
www.offroadfire.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
Loading Matlab variables into Java
I have written a program in Matlab which creates a matrix. I now need to use this matrix in my Java code but i dont know how to do this. One suggestion I was given was to save the Matlab matrix as a binary file (easy) and then load the file in Java. Does anyone know how I could do this? And are there better ways? I think there are ways of running Matlab code from Java and vice versa but i dont know what that involves.
Thanks.Well, OX
1) Use the Runtime.exec() method to execute the Matlab program
2) Get the InputStream from the Process object that the exec() method generates.
3) Modift the Matlab program to write the matrix in some format to the standard OutputStream of the Matlab program - for formating, you can take a row and print it to the OutputStream as a LWS separated line of text terminating with a CR-LF
4) Read the text line from the InputStream in the Java program.
5) Parse the string (may be with a StringTokenizer) and construct the matrix in a 2d array or by some other means.
Hope it helps!
Ironluca -
AS3.0 External Interface: Pass variables to flash using javascript
Hello all,
I am looking for a simple and straightfoward example of how I can pass the value of a variable into flash using javascript.
Specifically, I'd like to use javascript to pass the filename of an external video file that I would like to load into my flash movie.
I'd also like to call a function in the SWF that plays the movie once the filename as been passed to the flash movie.
External Inferface looks like the way to go.
I've found a few decent AS2.0 examples, but converting them to AS3.0 has proven difficult and many of the examples are much too complex for what I am trying to do.
If you have any code samples or tutorials showing the HTML/Javascript and the associated actionscript I'd really appreciate it!
Thanks!
Timif you create a swf (eiTest.swf) and html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>eiTest</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="JavaScript">
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
function f1(value) {
thisMovie("eiTest").jsF(value);
</script>
</head>
<body onload="f1('yourfilename.ext');">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="eiTest" width="550" height="400"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">
<param name="movie" value="eiTest.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#869ca7" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="eiTest.swf" quality="high" bgcolor="#869ca7"
width="550" height="400" name="eiTest" align="middle"
play="true" loop="false" quality="high" allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed>
</object>
</body>
</html>
you can use:
import flash.external.ExternalInterface;
ExternalInterface.addCallback("jsF", asF);
function asF(fileS:String):void{
trace(fileS); -
Returning php vars to flash AS
Hi,
I am not able to get a variable value from PHP back into
flash after sendAndLoad. I can only get the actual value returned
by php. here is the detail.
Initially from flash
dataOut.sendAndLoad("phptest.php", dataIn, "POST");
and the return from phptest.php
dataIn.onLoad = function() {
msg.text = ' returned from php is '+this.value1 + this.value2
the code in phptest.php
<?php
$a = "&value1=foo&";
$b = "&value2=";
$c = "bar&";
echo $a.$b.$c;
?>
in response
the msg.text reads like this
returned from php is foo";
It only returns the actual value of value1 and not the passed
value of value2, but one doublequote.
and this is what is displayed in the browser from the
phptest.php .
&value1=foo&&value2=bar&
any sugggestions. ?
Thanks for any helpthanks kglad
but how do you pass a variable value. For example, if you
don't want to send 'bar 'directly as the value for value2, but want
to use the value of a variable say $c which will have a value of
'bar', how do you pass that back to flash. In my example it won't
pass the value of $c as 'bar', unless I actually assign 'bar' to
value2. I need to be able to pass the value of $c rather than send
the assigned value. I looked at the various examples including
those from login examples, but they didn't work. has the same
problem. somehow AS does not seem to accept the values passed via
variable. Any other way to do it?
thanks -
this is the reading i currently get when i boot the switch(3548-XL-EN)...how do i load new ios into flash.....
C3500XL Boot Loader (C3500-HBOOT-M) Version 12.0(5.2)XU, MAINTENANCE INTERIM SOF
TWARE
Compiled Mon 17-Jul-00 18:42 by ayounes
starting...
Base ethernet MAC Address: 00:04:6d:f9:ee:00
Xmodem file system is available.
Initializing Flash...
flashfs[0]: 1 files, 1 directories
flashfs[0]: 0 orphaned files, 0 orphaned directories
flashfs[0]: Total bytes: 3612672
flashfs[0]: Bytes used: 1536
flashfs[0]: Bytes available: 3611136
flashfs[0]: flashfs fsck took 2 seconds.
...done Initializing Flash.
Boot Sector Filesystem (bs:) installed, fsid: 3
Parameter Block Filesystem (pb:) installed, fsid: 4
The system is unable to boot automatically because there
are no bootable files to boot.
switch:Thanks very much!!
Loaded the software but got the following while loading it and could ionly recognise the twio giagabit ports...all 48 fastethernet ports were missing
3611648 bytes available (1024 bytes used)
switch: copy xmodem:c3500XL-c3h2s-mz.120-5.WC3.bin flash:c3500XL-c3h2s-mz.120-5.WC3.bin
Begin the Xmodem or Xmodem-1K transfer now...
CCCCCCCCCCBB0BB0xmodem:c3500XL-c3h2s-mz.120-5.WC3: I/O error
switch: copy xmodem:c3500XL-c3h2s-mz.120-5.WC3.bin flash:c3500XL-c3h2s-mz.120-5.
WC3.bin
Begin the Xmodem or Xmodem-1K transfer now...
CCCCCCCCCC........................................rrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrru
Switch#sh post
C3500XL POST FAILURE: Ethernet Controller Test: Failed
C3500XL POST FAILURE: MII Test: Failed
Switch#
this also came up at boot up
FOUND an unknown transceiver on port 34
FOUND an unknown transceiver on port 45
FOUND an unknown transceiver on port 46
FOUND an unknown transceiver on port 47
FOUND an unknown transceiver on port 48
FOUND an unknown transceiver on port 49
FOUND an unknown transceiver on port 50
FOUND an unknown transceiver on port 51
FOUND an unknown transceiver on port 52
thanks
josh
Maybe you are looking for
-
Setting the value of a field based on a dropdown list
I am using the latest production release of JHeadstart 10.1.3.0.91. I am trying to set the value of a field based on selecting the value of another field (drop down list). The drop down list field has the following attributes set autoSubmit="true" im
-
Will a Apple iPhone work with a Lexus RX330
Does anyone know if a Apple ipod phone will pair up with a 2006 Lexus RX330 blue tooth system?
-
Nikon d5200 raw files will not open in PSE 10
I am currently using PSE 10 and have just upgraded my camera to a Nikon d5200 from a d5100. I cannot open the raw files for the d5200. Do I need a more up to date PSE or can you suggest which plug in update I require. Thank you
-
Sequence Settings for 5D Converted Footage
Hello, Can someone please tell me what the sequence settings should be for 5D footage that has been converted to Pro Res? I've changed the frame rate to 29.97. I looked at the easy setup, but it looks like that is 24p Pro Res, so that is not matching
-
How to restore backup files to a new database?
Hello all, Our database has stopped working because many config files and some control files were deleted or changed! You can see the full discussion here: ORA-01034 - Oracle not availabe We are using Oracle 11g. We got some comprehensive backup file