Search Results

Search found 60 results on 3 pages for 'externalinterface'.

Page 2/3 | < Previous Page | 1 2 3  | Next Page >

  • handling NSStream events when using EASession in MonoTouch

    - by scotru
    Does anyone have an example of how to handle read and write NSStream events in Monotouch when working with accessories via EASession? It looks like there isn't a strongly typed delegate for this and I'm having trouble figuring out what selectors I need to handle on the delegates of my InputStream and OutputStream and what I actually need to do with each selector in order to properly fill and empty the buffers belonging to the EASession object. Basically, I'm trying to port Apple's EADemo app to Monotouch right now. Here's the Objective-C source that I think is relevant to this problem: / / asynchronous NSStream handleEvent method - (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode { switch (eventCode) { case NSStreamEventNone: break; case NSStreamEventOpenCompleted: break; case NSStreamEventHasBytesAvailable: [self _readData]; break; case NSStreamEventHasSpaceAvailable: [self _writeData]; break; case NSStreamEventErrorOccurred: break; case NSStreamEventEndEncountered: break; default: break; } } / low level write method - write data to the accessory while there is space available and data to write - (void)_writeData { while (([[_session outputStream] hasSpaceAvailable]) && ([_writeData length] > 0)) { NSInteger bytesWritten = [[_session outputStream] write:[_writeData bytes] maxLength:[_writeData length]]; if (bytesWritten == -1) { NSLog(@"write error"); break; } else if (bytesWritten > 0) { [_writeData replaceBytesInRange:NSMakeRange(0, bytesWritten) withBytes:NULL length:0]; } } } // low level read method - read data while there is data and space available in the input buffer - (void)_readData { #define EAD_INPUT_BUFFER_SIZE 128 uint8_t buf[EAD_INPUT_BUFFER_SIZE]; while ([[_session inputStream] hasBytesAvailable]) { NSInteger bytesRead = [[_session inputStream] read:buf maxLength:EAD_INPUT_BUFFER_SIZE]; if (_readData == nil) { _readData = [[NSMutableData alloc] init]; } [_readData appendBytes:(void *)buf length:bytesRead]; //NSLog(@"read %d bytes from input stream", bytesRead); } [[NSNotificationCenter defaultCenter] postNotificationName:EADSessionDataReceivedNotification object:self userInfo:nil]; } I'd also appreciate any architectural recommendations on how to best implement this in monotouch. For example, in the Objective C implementation these functions are not contained in any class--but in Monotouch would it make sense to make them members of my

    Read the article

  • image with external interface

    - by Leo
    I need to send a picture to flash with external interface (as3)... can not be an url because don't have connection... I'm trying open the image file and send to flash like text but without success any idea?

    Read the article

  • Having trouble with Flash, Javascript and JQuery

    - by andypants
    I'm using JQuery with the JQuery flash plugin (http://jquery.lukelutman.com/plugins/flash/) and trying to send a JS call back to the flash, I keep running into "xxx is not a function" so apparently something is off. I'm new to JQuery and very new to this jquery flash plugin and just can't quite wrap my head around what I am doing wrong. Here's where I'm lading up the flash: <div id="tagimgback"> <script language="javascript"> $(document).ready(function(){ $('#tagflash').flash( { src: 'tagflash', width: 200, height: 200, flashvars: {theYear:'2010',theTagNumber:'123'} }, { version: 8 } ); }); </script> </div> And here's where I'm trying to call it: $("#tagflash").gotoNewFrame(theTagNumber); gotoNewFrame is an AS function within my flash. I know the function works as I've been able to test it prior to bringing jQuery into the mix.

    Read the article

  • I can't get ExternalInterface.addCallback to work - trying to call an AS3 function from a js button

    - by Guillaume Riesen
    I'm trying to use ExternalInterface.addCallback to allow js to call an as3 method. My code is as follows: AS: ExternalInterface.addCallback("sendToActionscript", callFromJavaScript); function callFromJavaScript():void{ circle_mc.gotoAndStop("finish"); } JS: Switch to square function callToActionscript() { flashController = document.getElementById("jstoactest") flashController.sendToActionscript(); } It's not working. What am I doing wrong?

    Read the article

  • When i close window cookies are destroying in flex

    - by praveen
    Hi, I am using external interface to store cookies in client side of application. Like I have created a cookie in html and i am using those methods in flex using External Interface. I am saving a username in cookie when I re use cookie is displaying, I have deployed in server and i ran like http://localhost/[Path]/index.html.in this html I am embedded swf file and I have saved cookie in html JavaScript, now if I open this url cookie is saving if I open a new window what ever the cookies are a raised and it is loading from start. for cookies saving i am using this code in flex:`package Name{ import flash.external.ExternalInterface; /** * The Cookie class provides a simple way to create or access * cookies in the embedding HTML document of the application. * */ public class Cookies { /** * Flag if the class was properly initialized. */ private static var _initialized:Boolean = false; /** * Name of the cookie. */ private var _name:String; /** * Contents of the cookie. */ private var _value:String; /** * Flag indicating if a cookie was just created. It is <code>true</code> * when the cookie did not exist before and <code>false</code> otherwise. */ private var _isNew:Boolean; /** * Name of the external javascript function used for getting * cookie information. */ private static const GET_COOKIE:String = "cookieGetCookie"; /** * Name of the external javascript function used for setting * cookie information. */ private static const SET_COOKIE:String = "cookieSetCookie"; /** * Javascript code to define the GET_COOKIE function. */ private static var FUNCTION_GET_COOKIE:String = "function () { " + "if (document." + GET_COOKIE + " == null) {" + GET_COOKIE + " = function (name) { " + "if (document.cookie) {" + "cookies = document.cookie.split('; ');" + "for (i = 0; i < cookies.length; i++) {" + "param = cookies[i].split('=', 2);" + "if (decodeURIComponent(param[0]) == name) {" + "value = decodeURIComponent(param[1]);" + "return value;" + "}" + "}" + "}" + "return null;" + "};" + "}" + "}"; /** * Javascript code to define the SET_COOKIE function. */ private static var FUNCTION_SET_COOKIE:String = "function () { " + "if (document." + SET_COOKIE + " == null) {" + SET_COOKIE + " = function (name, value) { " + "document.cookie = name + '=' + value;" + "};" + "}" + "}"; /** * Initializes the class by injecting javascript code into * the embedding document. If the class was already initialized * before, this method does nothing. */ private static function initialize():void { if (Cookies._initialized) { return; } if (!ExternalInterface.available) { throw new Error("ExternalInterface is not available in this container. Internet Explorer ActiveX, Firefox, Mozilla 1.7.5 and greater, or other browsers that support NPRuntime are required."); } // Add functions to DOM if they aren't already there ExternalInterface.call(FUNCTION_GET_COOKIE); ExternalInterface.call(FUNCTION_SET_COOKIE); Cookies._initialized = true; } /** * Creates a new Cookie object. If a cookie with the specified * name already exists, the existing value is used. Otherwise * a new cookie is created as soon as a value is assigned to it. * * @param name The name of the cookie */ public function Cookies(name:String) { Cookies.initialize(); this._name = name; this._value = ExternalInterface.call(GET_COOKIE, name) as String; this._isNew = this._value == null; } /** * The name of the cookie. */ public function get name():String { return this._name; } /** * The value of the cookie. If it is a new cookie, it is not * made persistent until a value is assigned to it. */ public function get value():String { return this._value; } /** * @private */ public function set value(value:String):void { this._value = value; ExternalInterface.call(SET_COOKIE, this._name, this._value); } /** * The <code>isNew</code> property indicates if the cookie * already exists or not. */ public function get isNew():Boolean { return this._isNew; } } } I am using cookie like thisvar anotherCookie:Cookies = new Cookies("username"); anotherCookie.value=[Textinput].text;`.is there any code i need to use save cookie in new window also? Please help me Thanks in Advance.

    Read the article

  • Control Javascript > CSS through Flash

    - by Jason b.
    Hi All, Ideal situation/setup: A page containing 1 Flash movie and a separate div containing a few hyperlinks. These hyperlinks each have a unique class name like so: Copy code <ul> <li><a href="" class="randomname1"></a></li> <li><a href="" class="randomname2"></a></li> <li><a href="" class="randomname3"></a></li> <li><a href="" class="randomname4"></a></li> </ul> The Flash movie itself will contain 4 buttons. Clicking on one of these buttons should make the Flash communicate with Jquery/JS and tell it to highlight the specific classname. Ideas so far For the javascript, it would look like $(function() { function setClass(className) {$("."+className).css("background","red");} }); And in specific keyframes within Flash 1. button 1 ExternalInterface.call("setClass","randomname1"); 1. button 2 ExternalInterface.call("setClass","randomname2"); 1. button 3 ExternalInterface.call("setClass","randomname3"); 1. button 4 ExternalInterface.call("setClass","randomname4"); The problem is that it is not really working well and i am not sure if i am making Flash communicate with JS properly. Any ideas or hints to steer me in the right direction again? Thank you in advance J.

    Read the article

  • How to catch a HTTP 404 in Flash

    - by Quandary
    When I execute the (2nd) below code with a wrong url (number '1' added at the URL end), I get the below error. How can I catch this error, in case the url is wrong, so that I can give out an error message to the user ? Error opening URL 'http://localhost/myapp/cgi-bin/savePlanScale.ashx1?NoCache%5FRaumplaner=F7CF6A1E%2D7700%2D8E33%2D4B18%2D004114DEB39F&ScaleString=5%2E3&ModifyFile=data%2Fdata%5Fzimmere03e1e83%2D94aa%2D488b%2D9323%2Dd4c2e8195571%2Exml' httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=404] status: 404 Error: Error #2101: Der an URLVariables.decode() übergebene String muss ein URL-kodierter Abfrage-String mit Name/Wert-Paaren sein. at Error$/throwError() at flash.net::URLVariables/decode() at flash.net::URLVariables() at flash.net::URLLoader/onComplete() public static function NotifyASPXofNewScale(nScale:Number) { var strURL:String ="http://localhost/myapp/cgi-bin/savePlanScale.ashx1" // CAUTION: when called from website, RELATIVE url... var scriptRequest:URLRequest = new URLRequest(strURL); var scriptLoader:URLLoader = new URLLoader(); // loader.dataFormat = URLLoaderDataFormat.TEXT; // default, returns as string scriptLoader.dataFormat = URLLoaderDataFormat.VARIABLES; // returns URL variables // loader.dataFormat = URLLoaderDataFormat.BINARY; // to load in images, xml files, and swf instead of the normal methods var scriptVars:URLVariables = new URLVariables(); scriptLoader.addEventListener(Event.COMPLETE, onLoadSuccessful); scriptLoader.addEventListener(IOErrorEvent.IO_ERROR, onLoadError); scriptLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler); scriptLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError); scriptVars.NoCache_Raumplaner = cGUID.create(); scriptVars.ScaleString = nScale; scriptVars.ModifyFile = "data/data_zimmere03e1e83-94aa-488b-9323-d4c2e8195571.xml"; scriptRequest.method = URLRequestMethod.GET; scriptRequest.data = scriptVars; scriptLoader.load(scriptRequest); function httpStatusHandler(event:HTTPStatusEvent):void { trace("httpStatusHandler: " + event); trace("status: " + event.status); } function onLoadSuccessful(evt:Event):void { trace("cSaveData.NotifyASPXofNewScale.onLoadSuccessful"); trace("Response: " + evt.target.data); ExternalInterface.call("alert", "Die neue Skalierung wurde erfolgreich gespeichert."); //getURL("javascript:alert(\""+"Die neue Skalierung wurde erfolgreich gespeichert.\\nALLE Instanzen des Browsers schliessen und neu starten, damit die Änderung in Kraft tritt."+"\");"); if (evt.target.data.responseStatus == "YOUR FAULT") { trace("Error: Flash transmitted an illegal scale value."); ExternalInterface.call("alert", "Fehler: Flash konnte die neue Skalierung nicht abspeichern."); } if (evt.target.data.responseStatus == "EXCEPTION") { trace("Exception in ASP.NET: " + evt.target.data.strError); ExternalInterface.call("alert", "Exception in ASP.NET: " + evt.target.data.strError); } } function onLoadError(evt:IOErrorEvent):void { trace("cSaveData.NotifyASPXofNewScale.onLoadError"); trace("Error: ASPX or Transmission error. ASPX responseStatus: " + evt); ExternalInterface.call("alert", "ASPX - oder Übertragungsfehler.\\nASPX responseStatus: " + evt); //getURL("javascript:alert(\"" + "ASPX - oder Übertragungsfehler.\\nASPX responseStatus: " + receiveVars.responseStatus + "\");"); } function onSecurityError(evt:SecurityErrorEvent):void { trace("cSaveData.NotifyASPXofNewScale.onSecurityError"); trace("Security error: " + evt); ExternalInterface.call("alert", "Sicherheitsfehler. Beschreibung: " + evt); } }

    Read the article

  • calling actionScript 2 function from C# help!

    - by phancuong87
    I want calling actionScript 2.0 function from c# , I using ExternalInterface.addCallback; In flash: ExternalInterface.addCallback("test", function (text : String) : Void { //code }); in C#: I using shockwave flash object player.CallFunction("" + "myString" + ""); but error: Error HRESULT E_FAIL has been returned from a call to a COM component. in C# I using cs4 and VS2008, please help me!

    Read the article

  • actionscript calling javascript with Security Exception

    - by Jeffrey Chee
    I have a swf hosted at domain A, and I have a html at domain B My swf is able to be loaded from accessing the html at domain B. However, the swf gets a SecurityError: Error #2060: Security sandbox violation: ExternalInterface caller http://domainA.com/TrialApp.swf cannot access http://DomainB.com/. The as3 is just the below: ExternalInterface.call("javascript:_invite();"); I've also loaded the crossdomain policy file from Domain B during initialization. Security.loadPolicyFile( "http://DomainB/crossdomain.xml" ); How do I go about solving this? in my html, I have allowscriptaccess='always' Thanks in Advance

    Read the article

  • Why calling flash function from javascript fails for me?

    - by Alan
    I'm doing it this way: ... public function j2fCall() { Alert.show( "j2fCall?"); } public function Main( nav: Navigation ) { if(ExternalInterface.available) { ExternalInterface.addCallback("javascriptUpdateSettings", j2fCall); } ... } But when I call javascriptUpdateSettings from javascript,only got the error: javascriptUpdateSettings is not defined What's wrong above? UPDATE I'm embedding swf and call it this way: swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0","expressInstall.swf", flashvars, params, attributes); swfobject.javascriptUpdateSettings();

    Read the article

  • Flash IO error while uploading photo with low uploading internet speed

    - by Beck
    Actionscript: System.security.allowDomain("http://" + _root.tdomain + "/"); import flash.net.FileReferenceList; import flash.net.FileReference; import flash.external.ExternalInterface; import flash.external.*; /* Main variables */ var session_photos = _root.ph; var how_much_you_can_upload = 0; var selected_photos; // container for selected photos var inside_photo_num = 0; // for photo in_array selection var created_elements = _root.ph; var for_js_num = _root.ph; /* Functions & settings for javascript<->flash conversation */ var methodName:String = "addtoflash"; var instance:Object = null; var method:Function = addnewphotonumber; var wasSuccessful:Boolean = ExternalInterface.addCallback(methodName, instance, method); function addnewphotonumber() { session_photos--; created_elements--; for_js_num--; } /* Javascript hide and show flash button functions */ function block(){getURL("Javascript: blocking();");} function unblock(){getURL("Javascript:unblocking();");} /* Creating HTML platform function */ var result = false; /* Uploading */ function uploadthis(photos:Array) { if(!photos[inside_photo_num].upload("http://" + _root.tdomain + "/upload.php?PHPSESSID=" + _root.phpsessionid)) { getURL("Javascript:error_uploading();"); } } /* Flash button(applet) options and bindings */ var fileTypes:Array = new Array(); var imageTypes:Object = new Object(); imageTypes.description = "Images (*.jpg)"; imageTypes.extension = "*.jpg;"; fileTypes.push(imageTypes); var fileListener:Object = new Object(); var btnListener:Object = new Object(); btnListener.click = function(eventObj:Object) { var fileRef:FileReferenceList = new FileReferenceList(); fileRef.addListener(fileListener); fileRef.browse(fileTypes); } uploadButton.addEventListener("click", btnListener); /* Listeners */ fileListener.onSelect = function(fileRefList:FileReferenceList):Void { // reseting values inside_photo_num = 0; var list:Array = fileRefList.fileList; var item:FileReference; // PHP photo counter how_much_you_can_upload = 3 - session_photos; if(list.length > how_much_you_can_upload) { getURL("Javascript:howmuch=" + how_much_you_can_upload + ";list_length=" + list.length + ";limit_reached();"); return; } // if session variable isn't yet refreshed, we check inner counter if(created_elements >= 3) { getURL("Javascript:limit_reached();"); return; } selected_photos = list; for(var i:Number = 0; i < list.length; i++) { how_much_you_can_upload--; item = list[i]; trace("name: " + item.name); trace(item.addListener(this)); if((item.size / 1024) > 5000) {getURL("Javascript:size_limit_reached();");return;} } result = false; setTimeout(block,500); /* Increment number for new HTML container and pass it to javascript, after javascript returns true and we start uploading */ for_js_num++; if(ExternalInterface.call("create_platform",for_js_num)) { uploadthis(selected_photos); } } fileListener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void { getURL("Javascript:files_process(" + bytesLoaded + "," + bytesTotal + "," + for_js_num + ");"); } fileListener.onComplete = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void { inside_photo_num++; var sendvar_lv:LoadVars = new LoadVars(); var loadvar_lv:LoadVars = new LoadVars(); loadvar_lv.onLoad = function(success:Boolean){ if(loadvar_lv.failed == 1) { getURL("Javascript:type_failed();"); return; } getURL("Javascript:filelinks='" + loadvar_lv.json + "';fullname='" + loadvar_lv.fullname + "';completed(" + for_js_num + ");"); created_elements++; if((inside_photo_num + 1) > selected_photos.length) {setTimeout(unblock,1000);return;} // don't create empty containers anymore if(created_elements >= 3) {return;} result = false; /* Increment number for new HTML container and pass it to javascript, after javascript returns true and we start uploading */ for_js_num++; if(ExternalInterface.call("create_platform",for_js_num)) { uploadthis(selected_photos); } } sendvar_lv.getnum = true; sendvar_lv.PHPSESSID = _root.phpsessionid; sendvar_lv.sendAndLoad("http://" + _root.tdomain + "/upload.php",loadvar_lv,"POST"); } fileListener.onCancel = function(file:FileReference):Void { } fileListener.onOpen = function(file:FileReference):Void { } fileListener.onHTTPError = function(file:FileReference, httpError:Number):Void { getURL("Javascript:http_error(" + httpError + ");"); } fileListener.onSecurityError = function(file:FileReference, errorString:String):Void { getURL("Javascript:security_error(" + errorString + ");"); } fileListener.onIOError = function(file:FileReference):Void { getURL("Javascript:io_error();"); selected_photos[inside_photo_num].cancel(); uploadthis(selected_photos); } <PARAM name="allowScriptAccess" value="always"> <PARAM name="swliveconnect" value="true"> <PARAM name="movie" value="http://www.localh.com/fileref.swf?ph=0&phpsessionid=8mirsjsd75v6vk583vkus50qbb2djsp6&tdomain=www.localh.com"> <PARAM name="wmode" value="opaque"> <PARAM name="quality" value="high"> <PARAM name="bgcolor" value="#ffffff"> <EMBED swliveconnect="true" wmode="opaque" src="http://www.localh.com/fileref.swf?ph=0&phpsessionid=8mirsjsd75v6vk583vkus50qbb2djsp6&tdomain=www.localh.com" quality="high" bgcolor="#ffffff" width="100" height="22" name="fileref" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></EMBED> My uploading speed is 40kb/sec Getting flash error while uploading photos bigger than 500kb and getting no error while uploading photos less than 100-500kb~. My friend has 8mbit uploading speed and has no errors even while uploading 3.2mb photos and more. How to fix this problem? I have tried to re-upload on IO error trigger, but it stops at the same place. Any solution regarding this error? By the way, i was watching process via debugging proxy and figured out, that responce headers doesn't come at all on this IO error. And sometimes shows socket error. If need, i will post serverside php script as well. But it stops at if(isset($_FILES['Filedata'])) { so it won't help :) as all processing comes after this check.

    Read the article

  • Flash AS3: (VideoEvent.COMPLETE, completePlay) - listener is triggered before video is completed

    - by Tevi
    Hello, I have a flash video using the standard FLV Playback component that comes with Flash. I'm using ActionScript 3 to modify the appearance and set up an event listener. I've set it up to go to a new URL using "externalInterface" when the video completes play. The URL is set in a variable using SWFObject. On only a few instances (3 people out of 50 - tested using Amazon Turk), people reported being taken directly to the new url, before the video even started playing. It's difficult to repeat the issue, but it did happen to me once. It doesn't have anything to do with cache, since it has been reported on people going to the url for the first time. Here's the url to the video: http://www.partstown.com/is-bin/INTERSHOP.enfinity/WFS/Reedy-PartsTown-Site/en_US/-/USD/ViewStaticPage-UnFramed?page=tourthetown Here's the code: import flash.external.*; import fl.video.*; var myVideo:FLVPlayback = new FLVPlayback(); var theUrl:String = this.loaderInfo.parameters.urlName; var theScript:String = this.loaderInfo.parameters.scriptName; myVideo.source = this.loaderInfo.parameters.videoPath;//"partstown.flv"; myVideo.skin = this.loaderInfo.parameters.skinPath;//"SkinUnderPlayStopSeekMuteVol.swf" myVideo.skinBackgroundColor = 0xAEBEFB; myVideo.skinBackgroundAlpha = 0.5; myVideo.width = 939; myVideo.height = 660; myVideo.addEventListener(VideoEvent.COMPLETE, completePlay); function completePlay(e:VideoEvent):void { myVideo.alpha=0.2; ExternalInterface.call(theScript); } addChild(myVideo); Why would the listener be triggered before the event complete? How can I fix it? Thanks!

    Read the article

  • How to protect a form HTML/PHP with JS callback to AS3

    - by Jk_
    Hi guys, I'm developing a Flash website (as3) where I need to be able to upload directly to YouTube by using the DATA API. However in order to do so, I had to use a proper HTML form on top of my flash object. Why? Because of the Browser Based Upload restictions. I first hide the form using JQuery and with a little CSS the form is display just where I want it. Within flash I use ExternalInterface.call() to show/hide the form when I need it! ExternalInterface.call("YTUploader.showIt"); The upload process is working great my only problem is that the form can be displayed easily... You just need a tool like firebug and you can use the form wherever you want on my flash app. So I was wandering which will be the best way to 'protect' this form or the best way to limit its access. Any advices will be appreciated. Thanks for your time. Jk.

    Read the article

  • How to protect and hidden form HTML/PHP with JS callback to AS3

    - by Jk_
    Hi guys, I'm developing a Flash website (as3) where I need to be able to upload directly to YouTube by using the DATA API. However in order to do so, I had to use a proper HTML form on top of my flash object. Why? Because of the Browser Based Upload restictions. I first hide the form using JQuery and with a little CSS the form is display just where I want it. Within flash I use ExternalInterface.call() to show/hide the form when I need it! ExternalInterface.call("YTUploader.showIt"); The upload process is working great my only problem is that the form can be displayed easily... You just need a tool like firebug and you can use the form wherever you want on my flash app. So I was wandering which will be the best way to 'protect' this form or the best way to limit its access. Any advices will be appreciated. Thanks for your time. Jk.

    Read the article

  • FLEX, how to specify parent html item, when I call external functions ?

    - by Patrick
    hi, I'm calling a javascript function from my flex application to set width and height of my html wrapper according to application size. However, I've many flex applications on my page and the wrappers have not id attribute. I'm using a unique javascript function and passing it the parameters. How could I specify the "parent" html element in these parameters ? Following is the code: Actionscript: if (ExternalInterface.available) ExternalInterface.call("changeSize",id, width, height); Javascript: <script type="text/JavaScript"> function changeSize(id, width, height) { console.log(id); console.log(width); console.log(height); } Wrapper: <div class="filefield-file clear-block"> <div class="filefield-icon field-icon-video-x-flv"> <img class="field-icon-video-x-flv" alt="video/x-flv icon" src="http://localhost/drupal/sites/all/modules/filefield/icons/protocons/16x16/mimetypes/video-x-generic.png"></div> <div style="background-color: rgb(255, 255, 255); width: 400px;"> <embed style="display: block;" src="/drupal/videoPlayer.swf?file=http://localhost/drupal/sites/default/files/files/projects/Project3/videos/9565274.flv" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" bgcolor="#ffffff" allowfullscreen="true" autoplay="true" flashvars="file=http://localhost/drupal/sites/default/files/files/projects/Project3/videos/9565274.flv" height="400" width="400"> <div>Scheduling Video</div> </div> </div>

    Read the article

  • Flash AS3 blur or liquify part of an image with mouse

    - by hamlet
    Hi, I am very beginner in flash. I want to load an image, show a cursor over the image and on mousedown I want to blur that actual part of the image. (e.g you can blur your face on the image and then save the new image). I can delete parts of the image with white line, but I would like to blur it instead // LIVE JPEG ENCODER 0.3 // from bytearray.org import asfiles.encoding.JPEGEncoder; import flash.external.ExternalInterface; ExternalInterface.addCallback("flash_saveImage", inflash_saveImage); var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, handleComplete); loader.load(new URLRequest(loaderInfo.parameters._filename)); //loader.load(new URLRequest("b.jpg")); var container_mc:MovieClip = new MovieClip;//create movieclip function handleComplete(e:Event):void { addChild(container_mc); var bitmapData:BitmapData = Bitmap(e.target.content).bitmapData; var matrix:Matrix = new Matrix(); container_mc.graphics.clear(); container_mc.graphics.beginBitmapFill(bitmapData, matrix, false); //container_mc.graphics.beginFill(0xFFFFFF,0); container_mc.graphics.drawRect(0, 0, bitmapData.width, bitmapData.height); container_mc.graphics.endFill(); swapChildren(container_mc, pencil); container_mc.addEventListener(MouseEvent.MOUSE_DOWN, startDrawing); container_mc.addEventListener(MouseEvent.MOUSE_UP, stopDrawing); container_mc.addEventListener(MouseEvent.MOUSE_MOVE, makeLine); } stage.addEventListener(MouseEvent.MOUSE_MOVE, moveCursor); Mouse.hide(); function moveCursor(event:MouseEvent):void { pencil.x = event.stageX; pencil.y = event.stageY; } function startDrawing(event:MouseEvent):void{ container_mc.graphics.lineStyle(20, 0xFFFFFF, 1); container_mc.graphics.moveTo(mouseX, mouseY); container_mc.addEventListener(MouseEvent.MOUSE_MOVE, makeLine); } function stopDrawing(event:MouseEvent):void{ container_mc.removeEventListener(MouseEvent.MOUSE_MOVE, makeLine); } function makeLine(event:MouseEvent):void{ container_mc.graphics.lineTo(mouseX, mouseY); } function inflash_saveImage ( ):void { var myURLLoader:URLLoader = new URLLoader(); var myBitmapSource:BitmapData = new BitmapData ( container_mc.width, container_mc.height ); // render the player as a bitmapdata myBitmapSource.draw ( container_mc ); // create the encoder with the appropriate quality var myEncoder:JPEGEncoder = new JPEGEncoder( 80 ); // generate a JPG binary stream to have a preview var myCapStream:ByteArray = myEncoder.encode ( myBitmapSource ); var header:URLRequestHeader = new URLRequestHeader ("Content-type", "application/octet-stream"); var myRequest:URLRequest = new URLRequest ( "save.php" ); myRequest.requestHeaders.push (header); myRequest.method = URLRequestMethod.POST; myRequest.data = myCapStream; myURLLoader.load ( myRequest ); } Thanks, hamlet

    Read the article

  • Pass HTML-DOM to Flex's actionscript.

    - by raj
    Hi, All i want is to pass a HTML-Form (DOM object) from javascript to Actionscript. i saw this article on the net and tried a similar code. But when i execute the code in IE, it alerts : "Out of memory at line 18". I'm stuck here from yesterday. i'll post the mxml and html here.. The MXML : <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()"> <mx:Script> <![CDATA[ public function init() : void { if (ExternalInterface.available) { try { ExternalInterface.addCallback("populateFlashFile", populateFlashFile); } catch (error:SecurityError) { } catch (error:Error) { } } } public function populateFlashFile(window:*) : void { log.text = window.toString(); // just for checking if window has come to the function. window.document.write("Hello"); } ]]> </mx:Script> <mx:TextArea x="10" y="23" width="712" height="581" id="log"/> </mx:Application> The HTML : <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body scroll="no"> <input type="button" onclick="document.getElementById('Test').populateFlashFile(window);"/> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="Test" width="100%" height="100%" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"> <param name="movie" value="Test.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#869ca7" /> <param name="allowScriptAccess" value="sameDomain" /> </object> </body> </html> The problem occors only when i pass some DOM object, if i pass some String it works.!!! i.e : <input type="button" onclick="document.getElementById('Test').populateFlashFile('some text here');"/> works great!

    Read the article

  • Actionscript can't call javasript from locally-saved html

    - by Dmitry Sapelnikov
    I try to perform calling of a javascript function from actionscript 3.0 thru ExternalInterface.call(). I've seen a lot of online examples where the method works perfectly. But all downloaded copies of the examples don't work. Flash player can't call javasript due to the swf-html container security problems. I've already tried to set allowScriptAccess value from "sameDomain" to "always". It haven't solved the problem.

    Read the article

  • flash blocking javascript events

    - by jedierikb
    this is an edit of the original post now that I better understand the problem. now with source code! In IE, if body (or another html div has focus), then you keypress & click on flash at the same time, then release... a keyup event is never fired. It is not fired in javascript or in flash. Where is this keyup event? This is the order of event firing you get instead: javascriptKeyEvent:bodyDn ** currentFocuedElement: body javascriptKeyEvent:docDn ** currentFocuedElement: body actionScriptEvent::activate ** currentFocuedElement: [object] actionScriptEvent::mouseDown ** currentFocuedElement: [object] actionScriptEvent::mouseUp ** currentFocuedElement: [object] Subsequent keyup and keydown events are captured by flash, but that initial keyUp is never fired.. anywhere. And I need that keyup! Here is the html/javascript: <html> <head> <script type="text/javascript" src="p.js"></script> <script type="text/javascript" src="swfobject.js"></script> <script> function ic( evt ) { Event.observe( $("f1"), 'keyup', onKeyHandler.bindAsEventListener( this, "f1Up" ) ); Event.observe( $("f2"), 'keyup', onKeyHandler.bindAsEventListener( this, "f2Up" ) ); Event.observe( document, 'keyup', onKeyHandler.bindAsEventListener( this, "docUp" ) ); Event.observe( $("body"), 'keyup', onKeyHandler.bindAsEventListener( this, "bodyUp" ) ); Event.observe( window, 'keyup', onKeyHandler.bindAsEventListener( this, "windowUp" ) ); Event.observe( $("f1"), 'keydown', onKeyHandler.bindAsEventListener( this, "f1Dn" ) ); Event.observe( $("f2"), 'keydown', onKeyHandler.bindAsEventListener( this, "f2Dn" ) ); Event.observe( document, 'keydown', onKeyHandler.bindAsEventListener( this, "docDn" ) ); Event.observe( $("body"), 'keydown', onKeyHandler.bindAsEventListener( this, "bodyDn" ) ); Event.observe( window, 'keydown', onKeyHandler.bindAsEventListener( this, "windowDn" ) ); Event.observe( "clr", "mousedown", clearHandler.bindAsEventListener( this ) ); swfobject.embedSWF( "tmp.swf", "f2", "100%", "20px", "9.0.0.0", null, {}, {}, {} ); } function clearHandler( evt ) { clear( ); } function clear( ) { $("log").innerHTML = ""; } function onKeyHandler( evt, dn ) { logIt( "javascriptKeyEvent:"+dn ); } function AS2JS( wha ) { logIt( "actionScriptEvent::" + wha ); } function logIt( k ) { var id = document.activeElement; if (id.identify) { id = id.identify(); } $("log").innerHTML = k + " ** focuedElement: " + id + "<br>" + $("log").innerHTML; } Event.observe( window, 'load', ic.bindAsEventListener(this) ); </script> </head> <body id="body"> <div id="f1"><div id="f2" style="width:100%;height:20px; position:absolute; bottom:0px;"></div></div> <div id="clr" style="color:blue;">clear</div> <div id="log" style="overflow:auto;height:200px;width:500px;"></div> </body> </html> Here is the as3 code: package { import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.KeyboardEvent; import flash.events.MouseEvent; import flash.events.Event; import flash.external.ExternalInterface; public class tmpa extends Sprite { public function tmpa( ):void { extInt("flashInit"); stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; stage.addEventListener( KeyboardEvent.KEY_DOWN, keyDnCb, false, 0, true ); stage.addEventListener( KeyboardEvent.KEY_UP, keyUpCb, false, 0, true ); stage.addEventListener( MouseEvent.MOUSE_DOWN, mDownCb, false, 0, true ); stage.addEventListener( MouseEvent.MOUSE_UP, mUpCb, false, 0, true ); addEventListener( Event.ACTIVATE, activateCb, false, 0, true ); addEventListener( Event.DEACTIVATE, dectivateCb, false, 0, true ); } private function activateCb( evt:Event ):void { extInt("activate"); } private function dectivateCb( evt:Event ):void { extInt("deactivate"); } private function mDownCb( evt:MouseEvent ):void { extInt("mouseDown"); } private function mUpCb( evt:MouseEvent ):void { extInt("mouseUp"); } private function keyDnCb( evt:KeyboardEvent ):void { extInt( "keyDn" ); } private function keyUpCb( evt:KeyboardEvent ):void { extInt( "keyUp" ); } private function extInt( wha:String ):void { try { ExternalInterface.call( "AS2JS", wha ); } catch (ex:Error) { trace('ex: ' + ex); } } } }

    Read the article

  • using addListener with WordPress audio player

    - by Jacob
    Hi, I'm trying to add a listener for the stop event in the word press audio player but usage seems to be undocumented. I'm hoping someone who knows a little flash can look at the code and tell me how it works: In the code at http://tools.assembla.com/1pixelout/browser/audio-player/trunk/source/classes/Application.as I see a snippet with this: ExternalInterface.call("AudioPlayer.onStop", _options.playerID); I was hoping that would let me capture the event in javascript with ("player" is the ID of my player) AudioPlayer.addListener("player", "AudioPlayer.onStop", function() { alert('stopped'); }); But my javascript function never seems to get called

    Read the article

  • Choosing random action, Flash AS3

    - by esryl
    I have 2 actions in a Flash file that I would like to test for conversion. One is opening a link in a tab/window, the other loading the content in a Colorbox iframe over the page. How do I randomly choose one of the following actions? I currently listen for a click on a button: clickJoin.addEventListener(MouseEvent.CLICK,toJoin); My two actions are: navigateToURL(new URLRequest("http://www.google.com/"), '_blank'); and ExternalInterface.call('$.fn.colorbox({ href: "http://www.google.com/", width:"80%", height:"80%", iframe:true, onLoad:function(){ $("#player").css({"visibility":"hidden"}); }, onClosed:function(){ $("#player").css({"visibility":"visible"}); }}) ');

    Read the article

  • Output Flash Trace to Firebug Console

    - by Nick
    Hello, I am trying to output my Flash application's trace to the firebug console. After some Goggling I have found that other are doing something like this: public static function debug(text: Dynamic):Void { trace(text); ExternalInterface.call("console.log", text.toString()); } My Firebug console never outputs anything and always just shows "Please Reload Page to enable..." So, of coarse, I have reloaded the page and it does not seem to change anything. I have the correct Object imported into the calling class. I am running FireBug 1.4.2. Can someone tell me how to implement this? Thanks! -Nick

    Read the article

  • Javascript Call function serverside

    - by Dusty
    I need to call a Javascript function from the server side in Client side. I looked and didn't find any way how to do it. I looked also over AJAX but can't figure it out. I am using ASP ( clasic) not .net . I need to call the function in client-side with a variable that comes from the client-side. Please help me!!! Thanks a million !!! I am using a FlashMovies that is sending a value to a Javascript function through ExternalInterface class. The function in javascript receiving it is gAnswer(result) and in this function i would need to have something like : Server side: function saveResult(result) {code to be saved on the server goes here } Client side : function gAnswer (result) { saveResult(result) } <- THis is the part i dont know how to do. The function gAnswer is being called when the flash movie finished by itself. Would you be able to provide some code on how to ? thanks to each one of you who helped me =)

    Read the article

< Previous Page | 1 2 3  | Next Page >