Viewpoint Forums
Viewpoint Forums
Viewpoint ZoomView & Flash Authoring
embed Flash connection with PHP/SQL|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Member |
is it possible to use sendAndLoad funcion in Flash for getting data from SQL database throught PHP when the Flash movie is embed into Viewpoint?
|
||
|
|
Member |
No. You would have to go through javascript like this:
Flash>VMP>Javascript>PHP>Javascript>VMP>Flash |
|||
|
|
Member |
So, according to your answere i started searching in documentation and in forum. Basicly I learned who to do it, but not sems to work. Here is my code:
1. I put an fscommand to the first frame of the embed Flash movie: fscommand ("PostMessage Message=calldata"); 2. I make an event handler to MTX file: <MTSHandle Event="calldata" Action="MTSJavaScript" Func="listdata();" /> 3. I create a Javascript funcion (i will skip the PHP part now and subtitude it with a variable called: phpdata): var phpdata="mylongstring"; function listdata() { vmp.SetProperty('myInteractor', 'stat', phpdata, 'mts_str'); vmp.PostEvent('setText', 0); } 4. Back to VMP to handle the function, and send the data to a Flash variable called "linkname": <MTSHandle Event="setText" Action="MTSSetProperty" Value="myInteractor.stat" Target="interface01.SWF._root.linkname" /> The problem is that "myInteractor.stat" not seems to hold any data. MTX: <MTSTimeElem Name="interface01" Type="SWFView" Path="interface01.swf" PostAnimator="1" On="1" /> <MTSInteractor Name="myInteractor" NeverHandle="1" > <MTSHandle Event="MouseLeftClick" Action="interface01" /> <MTSHandle Event="MouseMove" Action="interface01" /> <MTSHandle Event="MouseLeftDown" Action="interface01" /> <MTSHandle Event="MouseLeftUp" Action="interface01" /> <MTSHandle Event="calldata" Action="MTSJavaScript" Func="listdata();" /> <MTSHandle Event="setText" Action="MTSSetProperty" Value="myInteractor.stat" Target="interface01.SWF._root.linkname" /> </MTSInteractor> HTML: <script language="javascript"> <!-- var vmp; var phpdata="mylongstring"; function listdata() { vmp.SetProperty('myInteractor', 'stat', phpdata, 'mts_str'); vmp.PostEvent('setText', 0); } //--> </script> This message has been edited. Last edited by: SmokeDT, |
|||
|
|
Member |
Hello,
A better way would be not to try to set the 'stat' property in the interactor. It would be better if you declare a global variable in the mtx and assign a value to it from javascript. To declare a global variable in the mtx (or as mtx likes to call it -- a "developer-defined property"), call an action such as this one when your scene loads: <MTSAction Name="set_vars" > <MTSSetProperty Target="MTSScene.myVar" Value="(mts_str)some value" /> </MTSAction> Then assign it whatever value you want from javascript: function myFunc(){ vmp.SetProperty('MTSScene','myVar','my new value','mts_str'); } I have attached an example that demonstrates setting the value of the mtx global variable from javascript. Regards set_MTSScene_var.zip (9 KB, 34 downloads) |
|||
|
|
Member |
Cool!
A big smile on my face now Thanks for help! |
|||
|
| Powered by Eve Community |
| Please Wait. Your request is being processed... |
|
Viewpoint Forums
Viewpoint Forums
Viewpoint ZoomView & Flash Authoring
embed Flash connection with PHP/SQL
