Hi,
I have a simple standalone application written in Visual Basic that I'm porting to a browser based application using PHP/javascript.
The original VB application has some simple embedded flash games with token and point counters. The token and point values are being passed as variables between the application and the game.
I'm trying to achieve the same effect in my PHP port without modifying the actionscript code( using the variables in actionscript that already exist).
Below is Visual Basic code that's loading a value from a database and posting that value to flash using FlashVars:
Private Sub loadPlayer()
Try
If CtblPoints.CheckPointsByID(mCard) Then
objPoints = CtblPoints.GettblPointsByID(mCard)
objPlayerAc = CtblPlayerAccount.GettblPlayerAccountByPlayerID(objPoints.AccountId)
objPlayer = CtblPlayer.GettblPlayerByID(objPlayerAc.PlayerID)
objPlayerBal = CtblPlayerBalance.GettblPlayerBalanceByID(objPlayerAc.PlayerID)
objPlayerAcDetail = CtblPlayerAccountDetail.GettblPlayerAccountDetailByAmount(objPoints.AccountId)
strTotalPoints = Convert.ToString(objPlayerAc.Points)
strTotalWin = Convert.ToString(objPlayerBal.TokenAmount)
'Dim intTokenAmount As Decimal = Convert.ToDecimal(objPlayerBal.TokenAmount)
'strTotalWin = Convert.ToString(Convert.ToInt64(intTokenAmount * 100))
flashPlayer.Size = panelGame.Size
flashPlayer.FlashVars = "totalEntries=" & strTotalPoints & "&credit=" & strTotalWin
flashPlayer.LoadMovie(0, strGameFile)
flashPlayer.Play()
Else
Me.Close()
Dim frmInvCrd As New frmInvalidCard
frmInvCrd.ShowDialog()
End If
Catch ex As Exception
End Try
I'm trying to recreate this in PHP, but I'm at a loss as to how to begin implementing it.
The variables in flash are declared publicly, and global imports used:
import com.atticmedia.console.*;
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.utils.*;
First declaration of variable 'totalEntries' is:
public var totalEntries:int = 0;
and this is a snip of totalEntries being used in the actionscript
public function notifyServerOfUnwonCredits(param1)
{
var remainder:* = param1;
if (this.useServer)
{
this.targetWinAmount = 0;
this.cancelUpdateOverTime = F9.setEnterFrame(this.updateOverTime);
fscommand("OverTime", "" + remainder);
this.flashVarsUpdatedAction = function ()
{
originalTotalWin = totalWin;
return;
}// end function
;
}
else
{
this.setTotalEntries(100000);
this.setTotalWin(0);
}
return;
}// end function
Eventually I'll be passing these values back to a mySQL database.
Any insight into this would be extremely helpful, Thanks!