Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Podaci iz JS u ActionScript

[es] :: Javascript i AJAX :: Podaci iz JS u ActionScript

[ Pregleda: 1002 | Odgovora: 0 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Chumpitas088
Nikola Martinovic
Beograd

Član broj: 16900
Poruke: 54
212.200.146.*



Profil

icon Podaci iz JS u ActionScript13.05.2009. u 12:40 - pre 182 meseci
Pokusavam da ubacim podatke iz JavaScripta u flash ActionScript, ali mi ne ide. Radim na open source rjesenju (Red5) i treba samo da povezem sve to. Ujedno nisam strucan u svemu ovome, a resenje mi je hitno potrebno.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Code:

HTML code sa JS-om i ubacenim Flashom: 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript" >
function recieveTextFromFlash(Txt) {
    document.getElementById('htmlText').value = Txt;
}
</script>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
  Video:  
    <input name="htmlText" id="htmlText" />
<br/>
    <input type="button" name="sendToFlash" id="sendToFlash" value="Posalji u Flash" onclick="getElementById('flash').sendTextFromHtml(htmlText.value); document.getElementById('htmlText').value = ''" />
</form>
</br>
<embed src="SimpleSubscriber.swf" id="flash" quality="high" scale="exactfit" width="550" height="400" name="squambido" align="middle" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>
</body>
</html>

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

ActionScript:
Code:

/*
This sample is a basic recorder.  It saves the stream to the webapps/oflaDemo/streams folder and plays
it back once you click the stop button.
*/
import flash.external.*;
import mx.utils.Delegate;

// create basic netConnection object
var nc:NetConnection = new NetConnection();
var videoPath:String = "red5BroadcastDemo";
var instance:Object = null;
var method:Function = recieveTextFromHtml;
var wasSuccessful:Boolean = ExternalInterface.addCallback(VideoPath, instance, method);


// connect to the local Red5 server
nc.connect("rtmp://localhost/oflaDemo");

// create the netStream object and pass the netConnection object in the constructor
var ns:NetStream = new NetStream(nc);

// attach the netStream object to the video object
videoContainer.attachVideo(ns);

// listen for the button clicks
subscribeButton.addEventListener("click", Delegate.create(this, subscribeClick));
stopButton.addEventListener("click", Delegate.create(this, stopClick));

function subscribeClick():Void
{    
    // subscribe to the broadcast
    ns.play("videoPath", -1);
    
    // disable the playbutton
    playButton.enabled = false;
    
    // enable the stop button
    stopButton.enabled = true;
}

function stopClick():Void
{
    // close the netStream object
    ns.close();
    
    // clear the videoContainer
    videoContainer.attachVideo(null);
    videoContainer.clear();
    
    // enable the playbutton
    playButton.enabled = true;
    
    // disable the stop button
    stopButton.enabled = false;
}

function setupCameraMic():Void
{
    // setup cam
    cam = Camera.get();
    // setting dimensions and framerate
    cam.setMode(320, 240, 30);
    // set to minimum of 70% quality
    cam.setQuality(0,70);
    
    // setup mic
    mic = Microphone.get();
    mic.setRate(44);
}

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
Odgovor na temu

[es] :: Javascript i AJAX :: Podaci iz JS u ActionScript

[ Pregleda: 1002 | Odgovora: 0 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.