Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 793625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:10:56+00:00 2026-05-14T22:10:56+00:00

I have a simple standalone application written in Visual Basic that I’m porting to

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T22:10:56+00:00Added an answer on May 14, 2026 at 10:10 pm

    PHP Doesn’t work like that; it’s not going to be sitting around, in a persistent state that you can always contact and talk to. You’ll need a mechanism to send and receive data to the stateless backend. Now, luckily, flash works perfectly well with cookies, so using PHP sessions doesn’t produce an issue. So, the question is whether you want to pass the data to PHP via Flash, or pass the variables to Javascript via flash and then send them to PHP.

    Direct-via-flash route (bear with me, this is AS 2.0, but should work):

    Actionscript:

    function getData (path:String, req:Object, fn:Function) {
       var q:Object = new LoadVars();
       for (var prop in req) {
           q[prop] = req[prop];
       }
       q.action = path;
       q.onLoad = fn;
       q.sendAndLoad("/hooks/integrate.php",q,"POST");
    }
    

    in this example, I pass to a single file and specify a POST parameter, “action”, that tells the handling file what it is I want to do.

    <?php
    if (!isset($_POST['action'])) { die; }
    switch($_POST['action']) {
        case 'something':
    // snip...
    }
    

    And then calling the function is a snap:

    getData('saveVar',{varname: 'foo', varvalue: foo},mySuccessFunction);
    

    Alternatively, you could set something up using XHR/AJAX and pass the variables to Javascript by using the flash.external.ExternalInterface.call() method, but setting up such a solution is beyond the scope of this answer.

    Long story short, there is no quick and easy way to do it like you did in VB due to PHP’s nature as a stateless request-based web service; you will have to employ another mechanism.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 397k
  • Answers 397k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Finds all font tags within any p, and replaces it… May 15, 2026 at 3:15 am
  • Editorial Team
    Editorial Team added an answer To find matching items in a list, try this out:… May 15, 2026 at 3:15 am
  • Editorial Team
    Editorial Team added an answer It means "cast var1 into pointer to array of int". May 15, 2026 at 3:15 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.