nesbox / emulator

Emulator of NES, Super Nintendo, Sega Mega Drive, GameBoy video consoles
http://nesbox.com/emulator/
MIT License
598 stars 245 forks source link

Variable to URL #41

Open ghost opened 8 years ago

ghost commented 8 years ago

I am trying to use Javascript to pull a value from a drop down list. (ex. './snes/Breath_of_Fire.zip') and use that as the URL variable for Flashvars.

I have managed to pull the variable, but when I try to added to flashvars, it doesn't recognize it.

Is there a certain way the variable has to be specified in flashvars? Is this even possible?

The value is './snes/Breath_of_Fire.zip'

I did an alert(game) to show that the variable is being picked up.

Current Script:

var resizeOwnEmulator = function(width, height)
{
    var emulator = $('#emulator');
    emulator.css('width', width);
    emulator.css('height', height);
}

$(function()
{
    function embed()
    {
        var emulator = $('#emulator');
        if(emulator)
        {
            var game = document.getElementById('chosegame').value;
           alert(game);
            var flashvars = 
            {
                system : 'snes', 
                url : game 
                };
            var params = {};
            var attributes = {};

            params.allowscriptaccess = 'sameDomain';
            params.allowFullScreen = 'true';
            params.allowFullScreenInteractive = 'true';

            swfobject.embedSWF('bin/Nesbox.swf', 'emulator', '800', '600', '11.2.0', 'flash/expressInstall.swf', flashvars, params, attributes);
        }
    }

    embed();
});

Thank You!

ghost commented 8 years ago

Nevermind. I figured it out.

I attached the code if you are interested. :)

Console.txt

Thanks again!