Viewpoint Developer Central    Viewpoint Forums    Viewpoint Forums  Hop To Forum Categories  Viewpoint ZoomView & Flash Authoring    embed Flash connection with PHP/SQL

Moderators: e_phoenix13
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Member
Posted
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?
 
Posts: 14 | Registered: May 15, 2006Reply With QuoteEdit or Delete MessageReport This Post
Member
Picture of Admin
Posted Hide Post
No. You would have to go through javascript like this:

Flash>VMP>Javascript>PHP>Javascript>VMP>Flash
 
Posts: 1188 | Registered: January 08, 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
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,
 
Posts: 14 | Registered: May 15, 2006Reply With QuoteEdit or Delete MessageReport This Post
Member
Picture of Admin
Posted Hide Post
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

Zip/GZ archiveset_MTSScene_var.zip (9 KB, 34 downloads)
 
Posts: 1188 | Registered: January 08, 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Cool!
A big smile on my face now Smile
Thanks for help!
 
Posts: 14 | Registered: May 15, 2006Reply With QuoteEdit or Delete MessageReport This Post
  Powered by Eve Community  
 

Viewpoint Developer Central    Viewpoint Forums    Viewpoint Forums  Hop To Forum Categories  Viewpoint ZoomView & Flash Authoring    embed Flash connection with PHP/SQL