My blog and IE
22 Jun 2006After a long time, today I checked my blog in Internet Explorer. I found that there are many bugs. I would fix it soon. If you had problem reading post because of it, I am sorry about it.
After a long time, today I checked my blog in Internet Explorer. I found that there are many bugs. I would fix it soon. If you had problem reading post because of it, I am sorry about it.
When I was in Yahoo!, I heard about this new plugin architecture in Yahoo! Messenger. I was very excited because I could extend the capabilities of Yahoo! Messenger with my current skills set (ActionScript, HTML, JavaScript, C++). Now this is public, I can talk about it.
You can download the latest beta of Yahoo! Messenger and get the Yahoo! Messenger Plugin SDK (which contains a sdk documentation and one example plugin).
Justin has also blogged about it. I am sure, we would soon see some cool plugins. Yeah, I also have my own ideas which I would hopefully able to do in my free time.
Meanwhile, check out plugin-gallery for some cool plugins.
SoonR allows you to access your remote PC, skype account, Outlook etc from your mobile device without installing any software on your mobile device. However, you need to install SoonR desktop client on your PC.
Check out it’s features. Also check out two posts on Om Malik’s blog for review and comments.
SoonR has signed a deal with Tata Indicom. Interesting thing is, Tata Indicom guys got to know about SoonR from GigaOm.
In my last post, I talked about JavaScript Flex 2 component that can inject Javascript code in HTML wrapper’s context. I experimented to see, if we can load Javascript files (.js) using HTTPService (or flash.net.URLLoader) in Flex2/AS3 projects and inject it.
Example Flex 2.0 code:
import flash.external.ExternalInterface; import mx.events.; import mx.rpc.events.; import mx.rpc.http.HTTPService; import com.abdulqabiz.utils.JavaScript; private var javascript:JavaScript; private var service:HTTPService; private function onAppInit ():void { service = new HTTPService (); service.url = “test.js”; service.useProxy = false; service.resultFormat = “text”; service.addEventListener (“result”, injectJavaScript); service.send (); } private function injectJavaScript (event:ResultEvent):void { javascript = new JavaScript (); javascript.source = String(event.result); trace (“javascript injected: “ + event.result); } private function invokeSayHelloWorld ():void { ExternalInterface.call (“sayHelloWorld”); } private function invokeSaySomething (str:String):void { ExternalInterface.call (“saySomething”, str); }
Test.js used in example:
//test.js var myName = “Abdul Qabiz”; function saySomething (str) { alert (str); } function sayHelloWorld () { alert (“Hello World!”); }
You would need JavaScript.as (with proper package [directory structure]) and test.js (code posted above) in place to make above example to work.
I am thinking to load FABridge using this approach. I know, it’s practically of no use except keeping code and logic at one place.
Came up with this “What makes you happy is undefined”, a few days back. I think, it makes sense.
We need to figure our own list of things, which make us happy.
BTW! I am very happy. These words are outcome of my nature of observing human-nature :)
In last post, I showed, how can we inject JavaScript using ActionScript or MXML into host HTML container/page.
One more use-cases, I can think of:
I know subject line is confusing but I am not able to think of a better one.
I have written a Adobe Flex 2.0 component(JavaScript.as), which can be used as MXML tag in Flex 2.0 applications. You can write JavaScript code as text of this MXML tag. When your application loads, all that JavaScript code would be injected host HTML’s DOM.
Confused? Let’s look at some examples.
Sample MXML application using this component (test.mxml):-
var myName = “Abdul Qabiz”; function saySomething (str) { alert (str); } function sayHelloWorld () { alert (“Hello World!”); }
import flash.external.ExternalInterface; private function invokeSayHelloWorld () { ExternalInterface.call (“sayHelloWorld”); }
HTML code that embeds test.swf(output of above code):-
You don’t have Flash Player 9.
var swfObj = new SWFObject (“JavaScriptComponentTest.swf”,”JavaScriptComponentTest”, “300”, “300”, “9”, “#C0D4DD”, true); swfObj.write(“flashcontent”);
invoke saySomething ()
invoke sayHelloWorld ()
show myName
See an example Or Download (zip 133kb includes the SWF).
The code is available under the MIT license.
Disclaimer: I have only tested this in FireFox on Windows. So please drop a comment, if doesn’t work in your system.
Update:
March 6, 2007 - Fixed a bug, which popped-up after I implemented comment removal feature. Thanks to Joan for point it out.
March 5, 2007 - Library has been updated, it can now handle comments in JavaScript code. It would basically remove all comments before injecting it in HTML container.
Lots of talk going on Apollo. I have kept quite because I had not seen Apollo except in MAX-2005 but today I saw screenshots on Ryan’s blog. And I commented on his blog, I would like to see following things in Apollo:-
I just noticed that if you have multiple cameras attached to your machine, in that case Camera.getCamera (cameraName) doesn’t work Adobe Flash Player 9 beta 3. Camera.getCamera () works fine but that would return the default camera.
But if you want to use multiple cameras in your application, it seems you can’t. I have informed Adobe Flash Player team about it and I am sure, it would get fixed.
However, I wanted to see if I am doing any thing wrong in following code. This is the sample code to reproduce the problem. Please let me know (through comments), if there is some problem in code itself. Thanks.
package { import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.media.Camera; import flash.media.Video; import flash.events.*; public class CameraExample extends Sprite { private var video1:Video; private var video2:Video; private var cameraWidth:int = 640; private var cameraHeight:int = 480; public function CameraExample() { stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; var cameraNames:Array = Camera.names; trace (“Available cameras: “ + cameraNames); var camera1:Camera = Camera.getCamera(cameraNames[0]); var camera2:Camera = Camera.getCamera(cameraNames[1]); if(camera1 != null) { camera1.addEventListener(ActivityEvent.ACTIVITY, activityHandler); video1 = new Video(cameraWidth, cameraHeight); video1.attachCamera(camera1); addChild(video1); } else { trace(“Camera1 not working”); } if(camera2 != null) { video2 = new Video(cameraWidth, cameraHeight); video2.x = cameraWidth + 20; video2.attachCamera (camera2) addChild(video2); } else { trace(“Camera2 not working”); } } private function activityHandler(event:ActivityEvent):void { trace(“activityHandler: “ + event); } } }
FileReference’s onComplete event is not fired on Mac version of Adobe Flash Player 8.
We faced similar problem and found the workaround, thanks to comment by Bob on Nirav’s blog.
There is simple workaround, you need to sent empty response from upload server-side script. In php, you would just do echo (""); after file-upload code. In ASP, you can do Response.Write (""). In Java servlet, you can do:
response.getWriter().println(“”); response.getWriter().flush();
That’s all, now onComplete event should trigger on Mac’s Adobe Flash Player 8.
I am posting this with a specific subject line, so that developers can easily find by doing Google search.
Thanks to Bob and Nirav.