dimanche 26 mars 2017

Parsing Javascript variable to AS3

I'm trying to write a simple 2 way chat but got a problem. I'm sure it's very basic but couldn't figure out since I'm new to this.

Below is my JS code to pass a streamID to AS3:

    url: ajaxurl,
    type: 'POST',
    data: 'action=sd_chat_code&chat_code='+chat_code,
    success: function(data){
    error: function(data) {

and in AS file, I got the streamID passed through as below:

public function streamCompanion(data):void {
    var netStreamObj:NetStream = new NetStream(_nc);

the variable "data" above return "12345" correctly, I tried to output is via JS and there's nothing wrong:

ExternalInterface.class("function() { console.log("+data+") }")

the problem is netStreamObj.play(data) not working, but if I manually type in netStreamObj.play('12345'), it's working correctly.

Any advice would be greatly appreciated.

Aucun commentaire:

Enregistrer un commentaire