Warning: Parameter 1 to ace_where() expected to be a reference, value given in /nfs/c09/h02/mnt/127482/domains/todepoint.com/html/blog/wp-includes/plugin.php on line 227

Warning: Parameter 1 to ace_join() expected to be a reference, value given in /nfs/c09/h02/mnt/127482/domains/todepoint.com/html/blog/wp-includes/plugin.php on line 227
2011 December | toDeBlog

Archive for February, 2012

Auto Draft

Microsoft secrets

Client Microsoft’s innovation lab
Medium Web
Date June 2011
Description The smartest banner you have ever seen, more code in this small piece of flash than in a full bloated website.
Categories Flash programing, design
URL NA

Microsoft’s innovation lab

Client Microsoft
Medium Web
Date June 2011
Description The smartest banner you have ever seen, more code in this small piece of flash than in a full bloated website.
Categories Flash programing, design
URL NA

Microsoft’s innovation lab

Client Microsoft
Medium Web
Date June 2011
The smartest banner you have ever seen, more code in this small piece of flash than in a full bloated website.
Categories Flash programing, design
URL NA

Microsoft’s innovation lab

Amdocs

Client Amdocs
Medium Web
Date Apr 2011
Description Slick online presentation, the navigation is based on sliding, similar to the iPhone behavior.
Categories Flash programing, design
URL

Amdocs

Client Amdocs
Medium Web
Date Apr 2011
Description Slick online presentation, the navigation is based on sliding, similar to the iPhone behavior.
Categories Flash programing, design
URL

BabyFirstTV

Client BabyFirstTV
Medium Web
Date Oct 2010
Description Worked with BabyFirst team to program the client-side activities and medias manager for the BabyFistTV online platform. Advanced server communication, external medias management, statistic tracing.
Categories Flash programing
URL babyfirsttv.com

Injecting and calling JS functions from within flash using external

JS injection

I recently encountered a unique requirement in one of my projects, triggering the loading of a page in the background (outside of flash, using Ajax) from within flash.
Often you cannot rely on JS functions to be available, you could load public libraries (Jquery or equivalent) or inject your own functions to the DOM, I chose to inject my own.

This is how you do it:

1) import the external class.

import flash.external.ExternalInterface;

2) declare a constant variable with all the JS functions:

private const script_js :XML =
<script>
<![CDATA[
function() {
AJXFNC = {
ajaxFunction:function(_url){

var ajaxRequest;
try{
// Opera 8.0+, Firefox, Safari, Chrome
ajaxRequest = new XMLHttpRequest();
ajaxRequest.open("GET", _url, true);
ajaxRequest.send(null);

} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
ajaxRequest.open("GET", _url, true);
ajaxRequest.send();

} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
ajaxRequest.open("GET", _url, true);
ajaxRequest.send();

} catch (e){
// Something went wrong
return false;
}
}
}
}

}
}
]]>
</script>;

3) inject the JS to DOM:

try {
if( ExternalInterface.available )ExternalInterface.call( script_js );
} catch( error:Error ) {
trace("ExternalInterface is not available");
}

4) call a function:

ExternalInterface.call( "AJXFNC.ajaxFunction", "http://www.google.com" );

Sweet isn’t it?

Injecting and calling JS functions from within flash using external

JS injection

I recently encountered a unique requirement in one of my projects, triggering the loading of a page in the background (outside of flash, using Ajax) from within flash.
Often you cannot rely on JS functions to be available, you could load public libraries (Jquery or equivalent) or inject your own functions to the DOM, I chose to inject my own.

This is how you do it:

1) import the external class.

import flash.external.ExternalInterface;

2) declare a constant variable with all the JS functions:

private const script_js :XML =
<script>
<![CDATA[
function() {
AJXFNC = {
ajaxFunction:function(_url){

var ajaxRequest;
try{
// Opera 8.0+, Firefox, Safari, Chrome
ajaxRequest = new XMLHttpRequest();
ajaxRequest.open("GET", _url, true);
ajaxRequest.send(null);

} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
ajaxRequest.open("GET", _url, true);
ajaxRequest.send();

} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
ajaxRequest.open("GET", _url, true);
ajaxRequest.send();

} catch (e){
// Something went wrong
return false;
}
}
}
}

}
}
]]>
</script>;

3) inject the JS to DOM:

try {
if( ExternalInterface.available )ExternalInterface.call( script_js );
} catch( error:Error ) {
trace("ExternalInterface is not available");
}

4) call a function:

ExternalInterface.call( "AJXFNC.ajaxFunction", "http://www.google.com" );

Sweet isn’t it?

 

Bad Behavior has blocked 11 access attempts in the last 7 days.