Archive for the 'tips & tricks' Category

21
Jan

Clearing up all confusion and Myth on Flash Player’s GPU/Video Card acceleration

Hi there bros and sis,

I think this is quite an important research to do that to clear up all confusions and misconception of the GPU acceleration in Flash Player 10.
Though  a brief research has been done to clarify this, but i think i will look up on more information in this.

The first site below proven to answer most of the important questions, I have extracted few points from the site.
http://www.kaourantin.net/2008/05/what-does-gpu-acceleration-mean.html

Now to the tricky part, things which will cause endless confusion if not explained:

1. Just because the Flash Player is using the video card for rendering does not mean it will be faster. In the majority of cases your content will become slower.
… Content has to be specifically designed to work well with GPU functionality. The software rasterizer in the Flash Player can optimize a lot of cases the GPU cannot optimize, you as the designer will have to be aware of what a GPU does and adapt your content accordingly.

2. The hardware requirements for the GPU mode are stiff. You will need at least a DirectX 9 class card.
… So if Aero Glass does not work well on your machine the Flash Player will likely not be able to run well either in GPU mode

3. Pixel fidelity is not guaranteed when you use the GPU mode. You have to expect that content will look different on different machines, even colors might not match perfectly. This includes video.

4. Here is an example, left shows it running using the new gpu mode, right using the normal mode. This a video which is 320×240 pixels large showing red text and as you notice the gpu mode arguably looks better as the hardware does UV blending: (see attached picture)

5. Please do not blindly enable either new mode (gpu or direct) in your content. Creating a GPU based context in the browser is very expensive and will drain memory and CPU resources to the point where the browser will become unresponsive.

6. GPU functionality ties us together with the video card manufacturers and their drivers. Given that you can expect that a significant amount of customers will not be able to view your content if you enable this mode due to driver incompabilities, and various defects in the software stack.

————————————————————

Second site to further elaborate the points above : http://techreport.com/discussions.x/15710

We gave the new plug-in a shot, and while we didn’t see a huge difference in CPU usage on a Core 2 Duo E6400
…Uro says web developers actually have to enable GPU acceleration manually in the code

————————————————————

Sites from adobe also DIDN’T clearly document and explain this feature. (It seems they are really unsure themselves)
http://kb.adobe.com/selfservice/viewContent.do?externalId=kb405445

Adobe recommends DirectX 9.0 or later (on Windows) and Shader Model 3.0…
…If your video display card is not detected as a supported card, GPU effects and preferences will not be visible within the application…

GeForce 9 Series
9600GT, 9800 (single GPU variant one)

————————————————————

More digging on adobe site found me this :
http://www.adobe.com/products/flashplayer/systemreqs/index.html
…Flash Player will use software mode for systems that do not meet the system requirements…

http://labs.adobe.com/wiki/index.php/Flash_Player:9:Update:Full-Screen_Mode:Demos (scroll all the way down)
…Most of the demos that utilizes Hardware scaling are basically full screen videos instead of interactive contents.

————————————————————

Conclusion : The GPU acceleration is still at its very preliminary stage and we can’t depend on it for performance control. And to enable this mode, we have to use it INSIDE browser since I can’t seem to find anyone ‘answer’ to the question if this is possible to be utilize outside of a browser.

17
Dec

[Tips] Transitioning from AS2 to AS3, What you need to know

A quality article off actionscript.org :

AS 3.0 Coming From 2.0

Bryan Grezeszak is a freelance AS3 developer and a FlashDen flash component and template author. He is a thorough expert of both ActionScript 2.0 and 3.0, and is more than willing to answer any questions you may have.
Articles of 3 series by : http://www.actionscript.org/resources/auth…Bryan-Grezeszak

Comments on the articles :

Seriously it would worth your 20 minutes read on all of the article. Worth every single bits your seconds spent on questioning on the changes and things you have to adapt from AS2 to AS3. Especially the one that deals with the million dollar question…What is a static class? You can find the answer on the second article.
17
Nov

AS3 : Country Combobox Selector

I’d think some of us really will run into frustration when dealing with 100 over countries to be keyed into their combobox, manually everytime if their job deals with forms that has , country selection.

Here’s a sample function that will aid and speed up your process, assuming you have a ComboBox named cbCountry.

function cbCountryAddItem() {
var countryArray:Array            = ["Afghanistan", "Åland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, Democratic Republic", "Cook Islands", "Costa Rica", "Côte d'Ivoire (Ivory Coast)", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands", "Faroe Islands", "Fiji", "Finland", "France", "French Guiana", "French Polynesia", "French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard and McDonald Islands", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea (north)", "Korea (south)", "Kuwait", "Kyrgyzstan", "Lao People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libyan Arab Jamahiriya", "Liechtenstein", "Lithuania", "Luxembourg", "Macao", "Macedonia, Former Yugoslav Republic Of", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Palestinian Territories", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Réunion", "Romania", "Russian Federation", "Rwanda", "Saint Helena", "Saint Kitts and Nevis", "Saint Lucia", "Saint Pierre and Miquelon", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia and Montenegro", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "Spain", "Sri Lanka", "Sudan", "Suriname", "Svalbard and Jan Mayen Islands", "Swaziland", "Sweden", "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States of America", "Uruguay", "Uzbekistan", "Vanuatu", "Vatican City", "Venezuela", "Vietnam", "Virgin Islands (British)", "Virgin Islands (US)", "Wallis and Futuna Islands", "Western Sahara", "Yemen", "Zaire", "Zambia", "Zimbabwe"]

for (var i = 0; i<countryArray.length; i++) {
cbCountry.addItem({ label: countryArray[i], data:countryArray[i] })
}
}

15
Aug

[Tutorial] AIR Updater for Flash

Download file : http://www.myflashportal.com/tutorials/air/updater/update.zip
Download sample application : http://www.myflashportal.com/tutorials/air/updater/update.air

SUMMARY
Rejoice brothers and sisters! I had finally figured out the mystery of updating your Adobe AIR app that is built using Flash! Thank god through all the reference provided. But though Adobe announced that there is a framework for AIR, but they weren’t plan it for Flash, only for HTML/Javascript and Flex Flavour. I had a quick look on it, it’s really simple, and fast. Unlike the old time where we need to go through the pain of Updater class.

TUTORIALS
Coming soon. Working now. Will write when go home, you can have a quick look on the file, leave a comment or something if you have something that you are not sure :) . It’s pretty straightforward.

  1. Create an app, give it a version number
  2. Edit the versions.xml, put in the appropriate details
  3. Upload it on the server and see the magic
  4. Make sure that the version number for your app on the server is DIFFERENT from the one you are testing locally to avoid problem arising.

EXTRA NOTE
The ZIP file provided is created with intention that you can see the update in action, hence the version 1.0 on the fla file and the versions.xml (on myflashportal server) is 1.1.

I did not provide the Digital Certification file because you can create it on your own. I will provide a more detail when I get back.

04
Aug

How to cheat at card flipping animation

**click the cards face to flip back and forth.

Hi Guys n Gals, this is my first entry at myflashportal.com. i’m going to share a technique(i mean cheat :P ) that might come handy in a flash project.A card fliping animation. it’s really easy to do, you don’t need a complex mathmatical formula or a long timeline animation or a 3D engine. Here’s how to do it:-

1.Create new flash cs3 file

2.Create 2 square on the stage(the design is up to you).

3.Select and right click on one of the square and select convert to symbol and name it front. Make sure the registration point is at the center.

4.Do the same with the other square but name it back.

5.Put instance name front_mc in the front movieclip properties and back_mc in the back movieclip properties.

6.Select the free transform tool at the tool menu and select the back movieclip.

7.horizontally transfrom the back movieclip to look like a mirror reflection of the original movieclip.make sure the height and width is the same with the original size.

8.arrange both square in the center of the stage.and send the back movieclip to the back of the front movieclip.

9.create new layer at the timeline section and name it actions or anything you want and open the actionscript editor or press F9 and paste this code.

import gs.TweenLite;

front_mc.addEventListener(MouseEvent.CLICK, cardClick);

function cardClick(event:MouseEvent):void {

back_mc.visible = true;

TweenLite.to(front_mc,0.5,{scaleX:-1, overwrite:false});

TweenLite.to(front_mc,0,{alpha:0,delay:.15, overwrite:false});

TweenLite.to(back_mc,0.5,{scaleX:-1, overwrite:false, onComplete:hidden});

TweenLite.to(back_mc,0,{alpha:1,delay:.15, overwrite:false});

back_mc.addEventListener(MouseEvent.CLICK, backClick);

}

function hidden() {

front_mc.visible = false;

}

function backClick(event:MouseEvent):void {

front_mc.visible = true;

TweenLite.to(back_mc,0.5,{scaleX:+1, overwrite:false});

TweenLite.to(back_mc,0,{alpha:0,delay:.15, overwrite:false});

TweenLite.to(front_mc,0.5,{scaleX:+1, overwrite:false, onComplete:ReHidden});

TweenLite.to(front_mc,0,{alpha:1,delay:.15, overwrite:false});

}

function ReHidden() {

back_mc.visible = false;

}

tweenlite can be downloaded here : http://blog.greensock.com/tweenliteas3/