Loading external images with ActionScript 3
One technique of loading external images is using the Loader class. It's similar to the URLLoader class but the Loader class loads and displays loaded images and SWF content. The Loader class is a part of the DisplayObject class; it is capable of displaying content as well as loading it. The goal of this technique is to make the loading operation as fast and hassle free as the queuing process of Getminted and other websites of similar nature.
To load external images using the Loader class, you need to create an object of the Loader class.
var imgLoader:Loader = new Loader();
To load an image into the Loader Object, the load method of the Loader class is used, along with a URLRequest.
var imgLoader:Loader = new Loader(); imgLoader.load(new URLRequest('image.jpg'));
The LoaderInfo class also has events and event types that dispatch information about the progress of the load through the Loader class.
The code below traces a loaded message after the loader object has completed loading the image.
var imgLoader:Loader = new Loader(); imgLoader.contentLoaderInfo.addEventListner(Event.COMPLETE,loaderCompleteHandler); function loaderCompleteHandler(e:Event):void{ trace('Image has loaded.'); } imgLoader.load(new URLRequest('image.jpg'));
At this point all you have done is loaded in the image to the Loader Object. For the loaded image to display you will need to add the Loader object to the display list.
addChild(imgLoader);
The complete source code looks like this.
var imgLoader:Loader = new Loader(); imgLoader.contentLoaderInfo.addEventListner(Event.COMPLETE,loaderCompleteHandler); function loaderCompleteHandler(e:Event):void{ trace('Image has loaded.'); addChild(imgLoader); } imgLoader.load(new URLRequest('image.jpg'));
hope this helps...
Do you need a working .fla of this including a preloader? Buy me a coffee and I'll send it to you via email. Remember to reference your email address.
Plurk This Post
Buzz This Post
Delicious
Digg This Post
Ping This Post
Reddit
Stumble This Post
Making flash sites search engine friendly
Until now Flash sites have not ranked well with search engines because they could not index them. For web developers or SEO specialists, this meant extra work.
In a press release on Tuesday Adobe announced that it was working with both Yahoo! and Google to enable indexing of Flash files. The project will enable searches on Flash content to return text and links, which can then be indexed. Better still, current Flash content will be immediately searchable by search engines, without alteration.
David Wadhwani, general manager and vice president of the Platform Business Unit at Adobe said:
Until now it has been extremely challenging to search the millions of RIAs (rich Internet applications) and dynamic content on the Web, so we are leading the charge in improving search of content that runs in Adobe Flash Player. We are initially working with Google and Yahoo! to significantly improve search of this rich content on the Web, and we intend to broaden the availability of this capability to benefit all content publishers, developers and end users.
Of course, all this assumes that the search engine has the Flash tech working: Google is rolling out Flash search today, but Yahoo! said it was going to enable the feature in a later release of its search engine and that it was “working with Adobe to determine the best possible implementation.” And no, Microsoft wasn’t mentioned at all.
However, Adobe’s statement does indicate Adobe will work with other search engines as well. With Microsoft having its Flash competitor, Silverlight, however, I’m wondering if that will slow things down between the two companies.

Plurk This Post
Buzz This Post
Delicious
Digg This Post
Ping This Post
Reddit
Stumble This Post
Downgrade to Flash 9

Plurk This Post
Buzz This Post
Delicious
Digg This Post
Ping This Post
Reddit
Stumble This Post
Remove dotted lines from links
The dotted lines that appear around links is an accessibility feature for people who can't use a mouse and are forced to use a keyboard to navigate. It works well when you use the tab key but it still shows when you are using a mouse.
If your working on government sites that need w3c compliance then I would not recommend removing this feature, otherwise use the CSS code below.
a { /* Mozilla */ outline:none; /* IE */ -moz-outline-style: none; }
You could get fancy and use the dotted line to your advantage. With CSS you can change the dotted line type to solid or change its colour to suit the design.
Good Luck!

Plurk This Post
Buzz This Post
Delicious
Digg This Post
Ping This Post
Reddit
Stumble This Post
Adobe Announce Flash 10 For Android
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.

Plurk This Post
Buzz This Post
Delicious
Digg This Post
Ping This Post
Reddit
Stumble This Post
The name of this class, [class name], conflicts with the name of another class that was loaded, [class name]
I've never come across this error before and I'm sure its not common, unless you constantly send files somewhere on the planet with a different timezone.
I recently created a snow as2 script for BigStockFlash.com but it got rejected because of a class conflict error. I tested the files again and found nothing was wrong with the files.
I re-packaged the files without modifying the code and sent it through. This time it worked. The only difference was the time I sent it.
Solution
Change your system clock to be the same as the time in the country your sending the files to or wait 24hrs before sending them again,
Plurk This Post
Buzz This Post
Delicious
Digg This Post
Ping This Post
Reddit
Stumble This Post
How to create bubbles in flash (ActionScript 2.0)
Here is a simple peice of ActionScript that can also be used to create snow or rain. I've seen a few particle engines on the net that I easily could have used but I wanted something simpler.
So this is what I came up with.
var total:Number = 30; //total number of bubble var sw:Number = Stage.width; //stage width var sh:Number = Stage.height; //stage height for (var i=0;i<total;i++){ var bubble:MovieClip = this.attachMovie("mcBubble", "mcBubble"+i,this.getNextHighestDepth()); // set the initial random speed bubble.yspeed = random(500) + 3; // set the initial random position bubble._y = sh; bubble._x = random(sw); // set the initial wobble factor (the X movement) bubble.xspeed = random(3); if (random(2) eq 1) { bubble.xspeed = -bubble.xspeed; } bubble.onEnterFrame = function(){ // the bubble movement this._y = this._y - this.yspeed; // check if the bubble is out of the top of the screen if (this._y <= -15) { // then reset to the bottom this._y = sh; this._x = random(sw); this.yspeed = random(5) + 3; // now to randomise the scale of the bubble so // we get a few wee ones too scale = 2 + (random(8)); this._width = scale; this._height = scale; // set the initial wobble factor (the X movement) this.xspeed = random(3); if (random(2) eq 1) { this.xspeed = -this.xspeed; } } // change the X value of the bubble this._x = this._x + this.xspeed; // the bounce code for either the left or right of the // margin for the bubble if (this._x > 100 or this._x < 50) { this.xspeed = -this.xspeed; } } }
Easy.. now this is what it looks like.
You could make it more realistic by tweaking the speed, wobble values and add blurs or better graphics but what I needed it for, this is perfect.
Download the Source Code - Use it any way you want, just let others know how you used it by leaving a comment. Peace!
Enjoy.
Plurk This Post
Buzz This Post
Delicious
Digg This Post
Ping This Post
Reddit
Stumble This Post
Disable all buttons in flash or disable 1 button in flash
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..
Plurk This Post
Buzz This Post
Delicious
Digg This Post
Ping This Post
Reddit
Stumble This Post
IE6 link problem – links are not clickable in some areas of the page
IE6 does not recognize links when placed over an absolute positioned background .png image.The solution is simple. Simply add "position: relative" to you links.
Plurk This Post
Buzz This Post
Delicious
Digg This Post
Ping This Post
Reddit
Stumble This Post
How to remove yellow background from Google Autofill in your web form
The best way is using CSS (Cascading Style Sheets) by adding background colour for your form field with !important.
For example:
input {background-color: #FFF !important;}
Plurk This Post
Buzz This Post
Delicious
Digg This Post
Ping This Post
Reddit
Stumble This Post
