Archive

Posts Tagged ‘flash’

Using swfObject with Mootools

August 4th, 2009

I'm sure most of us use swfObject, which in my opinion is the best option when it comes to embedding flash.

Lately I've been having a lot of fun with mootools and needed a way to embed flash dynamically. Basically I wanted my flash file to be embedded after a mootools click event was triggered.

So without further ado..

window.addEvent('domready', function() {
 
//get the div I want to embed my flash into.
var flashcontainer = $('flashcontainer');
 
//set all the flash properties
var file = 'file.swf';
var moviename = 'nameMyFlash';
var width = '640';
var height = '424';
var version = '9';
var bgcolor = '#000000';
 
//create the function that will fuse swfObject with mootools
var embedFlash = function(){
    var so = new SWFObject(file, moviename, width, height, version, bgcolor);
	     so.addParam("quality", "high");
	     so.addParam("align", "middle");
	     so.addParam("play", "true");
	     so.addParam("loop", "true");
	     so.addParam("scale", "exactfit");
             so.addParam("allowFullScreen", "true");
	     so.addVariable("variable1", "variable 1 value goes here");
	     so.addVariable("variable2", "variable 1 value goes here");
	     so.write(flashcontainer);
}
 
//get button by id
var myButton = $('mybutton'); 
 
// create click event to fire my function called "embedFlash()"
myButton.addEvent('click', embedFlash); 
 
});

And that's it.. Hope it helps....

You can download the latest tools used above from the links below:
MooTools - download release 1.2.3 or SWFObject 2.2

Post to Twitter Post to Plurk Plurk This Post Post to Yahoo Buzz Buzz This Post Post to Delicious Delicious Post to Digg Digg This Post Post to Ping.fm Ping This Post Post to Reddit Reddit Post to StumbleUpon Stumble This Post

Flashnutz ActionScript 2.0, ActionScript 3.0, Mootools , , ,

Adobe Announce Flash 10 For Android

February 16th, 2009

Adobe have announced that Flash 10 will be making it's way to the Android platform by the end of the year. In an announced at the Mobile World Congress event in Barcelona, Adobe revealed that they plan to release their first full-fledged Flash multimedia player for smartphones by the end of 2009.

"We've made a lot of progress, but there is still a lot of engineering work to be done," said Anup Murarka, director of partner development and technology strategy for Adobe's platform business unit.

Adobe are expected to demonstrate the Flash Player 10 for smartphones beta during the Mobile World Congress event.

Post to Twitter Post to Plurk Plurk This Post Post to Yahoo Buzz Buzz This Post Post to Delicious Delicious Post to Digg Digg This Post Post to Ping.fm Ping This Post Post to Reddit Reddit Post to StumbleUpon Stumble This Post

Flashnutz News , , ,

Disable all buttons in flash or disable 1 button in flash

February 3rd, 2009

Recently I needed to disable all buttons on my flash site. I trawled the net looking for answers but all I got was what I already knew. Which is disabling each button 1 by 1 using an array like so:

 
//an array of button instance names
var buttonInstanceNames:Array = new Array("button1","button2",
"button3", "button4");
 
//function that sets the buttons enabled state
function enableButtons(e){
   for(var i=0;i<buttons.length;i++){>
      this[buttonInstanceNames[i]].enabled = e;
   }
}
 
//call function and assign enabled state
enableButtons(false);

This is all good if you have a few buttons but what if your site is complex like the 1 I was working on and you wanted to disable all button interactivity without knowing buttons instance names.

Solution
Basically place a movie clip button over the entire movie or just over the area where your buttons are with _alpha set to 0. Remember to set the movie clip with a onRollOver, or onRelease event. Just set the blocking movie clip's _visible state to false when you want interactivity back.

Here is the code I used to get this working.

 
//The instance name of my blocker movieclip is "mcBlocker"
//show or hide the button blocker
function enableButtons(e){
   mcBlocker._visible = e;
   mcBlocker.onRollOver = doNothing;
 }
 
//do nothing when the blocker active
function doNothing(){}
 
//just enable or disable the blocker
enableButtons(false);
 

Hope this helps..

Post to Twitter Post to Plurk Plurk This Post Post to Yahoo Buzz Buzz This Post Post to Delicious Delicious Post to Digg Digg This Post Post to Ping.fm Ping This Post Post to Reddit Reddit Post to StumbleUpon Stumble This Post

Flashnutz ActionScript 2.0 , ,

Papervision3D

February 14th, 2008
SEO Powered by Platinum SEO from Techblissonline