|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#16
|
|||
|
|||
|
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 |
|
#17
|
|||
|
|||
|
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! |
|
#18
|
|||
|
|||
|
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 |
|
#19
|
|||
|
|||
|
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 |
|
#20
|
|||
|
|||
|
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?
|
|
#21
|
|||
|
|||
|
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 |
|
#22
|
||||
|
||||
|
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 |
|
#23
|
|||
|
|||
|
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...
|
|
#24
|
|||
|
|||
|
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 |
|
#25
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > PHP into Flash |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|