Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript throws error when trying to send var to AS3 ExternalInterface
    primarykey
    data
    text
    <p>I know there have been tons of questions about this topic already but none of them have solved my issue, perhaps I am just missing something.</p> <p>Anyways, here is the deal. I have a happy little html5 game that plays some audio and sound affects etc and it works great in every browser that supports html5. However, those that don't require a flash fallback. No big deal right? Apparently not… I've made a small swf that should accept the mp3 url from JS and then get the mp3 and play it. I have to use this way as there are a lot of audio files and I would like to try and avoid making a swf file for each one.</p> <p>Here is the AS - I'm using the ExternalInterface to receive the variable from js.</p> <pre><code> import flash.external.*; ExternalInterface.addCallback("callFlash", playSound); function playSound(file:String):void { var s:Sound = new Sound(); s.load(new URLRequest(file)); s.play(); } </code></pre> <p>And then my JS to pass the variable:</p> <pre><code> var flash = $('#fbplayer')[0]; console.log(flash); //returns flash object so jquery is not the issue flash.callFlash(fallSource); </code></pre> <p>So theoretically everything should work fine (if I understand ExternalInterface correctly). However, the following error is thrown:</p> <pre><code> TypeError: flash.callFlash is not a function flash.callFlash(fallSource); </code></pre> <p>I can't seem to find where the issue was. I'm open to any answers or even a completely different way of doing this. As long as it works as this is holding up the delivery of the project :C</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload