blog

Tag Archive for JavaScript at Jozef Chúťka's blog

March 25, 2013

No comments

Haxe JavaScript JUnitReport unit tests

Unit Testing HaXe JavaScript Project

haxeunit

Today I continued to progress on my Samsung Smart TV project with unit test implementation. My aim is to prepare smooth process for automated builds. First, I tought I would struggle with it much more but at the end it appeared that necessary tools already exists.

My first sreps led me to “Writing Unit Tests” article about resources available directly with HaXe, however it seemed that JavaScript testing was not available. The article also referenced MUnit a cross-platform haxe unit testing framework, which looked to have more capabilities.

Read the rest of this entry »

September 21, 2010

22 Comments

AIR Facebook HTMLLoader JavaScript NativeWindow NativeWindowInitOptions

Authorizing Facebook Applications in AIR

Adobe AIR and Facebook logos side by side.

I was asked to make AIR compatibile version of FacebookOAuthGraph class. It was a nice little challenge for me, where I learn some new things about AIR. E.g. how easy it is to define the JavaScript callback directly from ActionScipt (HTMLLoader.window.methodName)… There are more ways to make authorization process work for you, I have chosen the one with popup window. In order to make FacebookOAuthGraph work for AIR, the short extending is required, instead of creating popup window from JavaScript, popup is created by HTMLLoader.createRootWindow (no ExternalInterface required)…

Read the rest of this entry »

February 12, 2010

No comments

ActionScript ExternalInterface JavaScript

Quick tip: ExternalInterface.call is synchronous!

A hand holding a red stopwatch.

It is a little wonder to me how flash player communicates with JavaScript. Calls are fully synchronous, it works as those (fp and js) were fully integrated into each other. To simulate this lets test some simple flow:

Read the rest of this entry »

February 10, 2010

4 Comments

allowscriptaccess eval ExternalInterface JavaScript

Full JavaScript Access From ActionScript (update)

Syntax-highlighted HTML showing the head element and metadata.

Have you ever tought about accessing DOM from ActionScript? In fact, you can do it and even far more. You can create and call JavaScript methods and objects, access cookies, change styles… All you need is correct AllowScriptAccess parameter within your flash object. No framework needed here, no hacks, ExternalInterface takes care.

Read the rest of this entry »

October 19, 2009

25 Comments

api Facebook facebook api JavaScript solution

FB.Connect.showPermissionDialog

Facebook dialog requesting permission to publish posts to a user’s feed.

If your facebook iframe applications need extra permissions granted, you can use Facebook JavaScript Api to generate modal window over your content to request permissions from users. For this purpose I created a simple FB_test_perm() function. It takes 4 arguments:

api_key – your application api key

xd_receiver – path to xd_receiver.htm file (Cross-Domain Receiver Page)

permission – publish_stream, read_stream …

callback – your function with boolean return (true if permission granted, false if not granted)

Read the rest of this entry »

October 19, 2009

35 Comments

ActionScript browser Canvas Flex FlexIFrame html IFrame JavaScript web

Flex IFrame – Web browser in flash (update)

Clipboard02

You can not have a web browser inside your web flash applications right? Well, you can! This solution uses html iframe to generate fake build in browser. So the behaviour of the browser in flash is the same as the one you are previewing this flash in (it is the same one). The best part of it is, you can manipulate with the position and size of this browser directly from flash. sk.yoz.html.IFrame solution was inspired by Alistair Rutherford, www.netthreads.co.uk.

sk.yoz.html.IFrame

FlexIFrame.js

Application

Application html

Read the rest of this entry »