Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #16  
Old February 19th, 2002, 01:47 PM
NETbreed NETbreed is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Posts: 4 NETbreed User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi Ben,

All I can say is that you must have excellent taste

I hope you enjoy the book, and if you have any problems or questions you can find me over at URL

Regards,

Steve Webster
Author - Foundation PHP for Flash

Reply With Quote
  #17  
Old August 18th, 2003, 01:23 AM
mp3sk8er mp3sk8er is offline
rarr!
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 5 mp3sk8er User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ok... so i've read over this thread many times and i still don't get it... so i'll explain my problem hoping someone will help me from the start:

i have a php file "news.php"
i have my flash file "main.fla"
i have created a dynamic text box in my flash file

this is where i am lost... do i need to create a line in the php?
i am so confused as where to start! please help!

Reply With Quote
  #18  
Old August 19th, 2003, 07:03 AM
whiterabbit whiterabbit is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 23 whiterabbit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Step back and get a broad view.

You have a Flash page, the html page that the flash page is embeded in and then a completely different page which contains your php code. The page with the php code will present the variables to flash.

Start by debugging your php page. View it outside of flash to see if the variables are being echo'd. If everything looks correct then proceed with getting them into flash.

To do this you need to present the variables in a way that flash wants ie

<?php

//your variables

$video= "benhur";
$size="4800000";
$play="60";
$load="200";

//present your vairables to flash

$vid = "video=";
$vid .= rawurlencode($video);

$siz = "size=";
$siz .= rawurlencode($size);

$pla = "play=";
$pla .= rawurlencode($play);

$loa = "load=";
$loa .= rawurlencode($load);

echo("$vid&$siz&$pla&$loa&$end=1");
?>

In Flash you are gong to look for the variables video, size, play and load. To do this use a load variable action into level0. Things to watch out for are that the variables must be available when the playhead asks for them or them will not show up.

To do this you can create one extra variable in your php page $end=1. When you load your variables into Flash, send the playhead into a loop until end evaluates to 1.
When it does, be sure to reset $end in Flash to empty for the next go around...that is assuming you will be loading more variables.

That is pretty much it, rawurlencode may not be needed, its safer to use it depending on what the variable contains. Take it step by step and its easy.

Hope that helps

Reply With Quote
  #19  
Old August 19th, 2003, 07:27 AM
Dan_Mitchell Dan_Mitchell is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 4 Dan_Mitchell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hello there

i have just read thru this post and found it very interesting and seem to be having many of the same problems that the originator did my php files are fine, i am a php developer and using flash for the front end my php file is echoing the following string at the moment

&title=Test Title 2&article=I am now waiting

i call this into flash like this

loadVariables("getnews.php", this, "POST");
showText(_root.string);

the variable in my php script is called $string so i presume that it is the same within flash?

a guy i work with designs the front end flash file and he has made it so that frame 74 does the news text box, it is dynamic and when he gave it to me he had this in the actions from

my_text = "testing";
showText(my_text);

this displayed the word testing fine so i tried to follow that by doing what i have pasted above with

showText(_root.sting)

i seem to be going wrong somewhere and i dont have a clue and ive been doing this for 5days now, ive read alot of tutorials and check out many projects (AMFPHP, phpforflash, ghostwriters) and as you could imagine im a bit furstrated so any help would be much appriecated and if i can help anyone with any php related issues let me know

Many thanks in advance
Daniel Mitchell

Reply With Quote
  #20  
Old August 19th, 2003, 11:09 AM
mp3sk8er mp3sk8er is offline
rarr!
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 5 mp3sk8er User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ok... i am starting to understand a little... especially because the page i was trying to pull up in flash wasn't compatible (ie didn't have any echos...) but why are there two "vid" and "siz" codes? and what does the "rawurlencode($variable)" mean?

Reply With Quote
  #21  
Old August 20th, 2003, 03:42 PM
whiterabbit whiterabbit is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 23 whiterabbit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Flash likes to see the variables presented as

something=1&somethingelse=2 and so on

in my example that string is in the variables. Notice its not echod out as vid=benhur but $vid which has a value of vid=benhur thats all that is happening there. Raw url encode should be used when you have strings that may contain conflicting characters such as those for a space. I am rusty on the exact def. so look that one up.

Dan,

You should be looking for tirtle and article and you should use a variable end like I mentioned to check first and be sure your variables are in before you ask to display them.

Also I dont have Flash in front of me but why the POST. I think you want to just load to root level without selecting any send options.

Hope that helps

Reply With Quote
  #22  
Old August 20th, 2003, 06:37 PM
blatant's Avatar
blatant blatant is offline
World Domination
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: San Diego
Posts: 126 blatant User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 47 m 17 sec
Reputation Power: 6
Send a message via AIM to blatant
I find it very helpful to use the flash loadvars object:

Code:
myVars = new LoadVars();
myVars.onLoad = myVarsLoaded;
myVars.load("myscript.php);

function myVarsLoaded(success) {
  if(sucess) {//your code here}
  else {// there was an error loading the vars 
}


This has a few advantages:
1) all the vars are loaded into the myVars object, so you know right where they are instead of using _level0.whatever like I saw somebody else suggest.

2) It handles the case where something goes wrong and there is an error loading

3) it doesn't execute "//your code here" unless the variables are loaded. I have run into issues where it takes a few seconds to load up particularly long variables (paragraphs), and I tried to run code too soon, when the variables were still undefined

4) you never have to use rawurlencode with loadvars

for more info, see the flash help

Reply With Quote
  #23  
Old August 20th, 2003, 08:08 PM
mp3sk8er mp3sk8er is offline
rarr!
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 5 mp3sk8er User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ok... well... i'm very thankful for all the help... but i guess i jsut don't get it... and i've tried everything everyone has said... so i just tried a different approach (giving up) and i'll just build the page a different way then what i was trying...

Reply With Quote
  #24  
Old August 21st, 2003, 06:16 AM
Dan_Mitchell Dan_Mitchell is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 4 Dan_Mitchell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks whiterabbit, i have now had a play around and managed to get some test vars into flash like this

<?php

echo ("&var_1=test&");

?>

this works ok but when i pull something from my database into flash eg $title

$title = "title=";
$title .= $row[news_title];

echo ("&$title&");

when i pull it into flash i see $title but it has no value and i dont see title this is wrong i take it

i am going to try some methods today but any suggestions would be great

Thanks

Reply With Quote
  #25  
Old August 21st, 2003, 08:46 AM
Dan_Mitchell Dan_Mitchell is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 4 Dan_Mitchell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Well now im having a new problem

this is my php file

<?php

echo ("&var_2=test&");

?>

and this is my flash

loadVariablesNum("var.php", 0);

showText(var_2);

when i use the debug tool it shows that var_2 is loaded into flash in local this but when i try and display it with showText() it doesnt do anything :/

Any help would be much appreicated

Dan

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > PHP into Flash


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT