Flash/Flex Tidbit #2 How to use Alpha Mask in Flash CS3

Oct
21

So the other day I spent 2hrs looking for how to and trying to do an alpha mask (I’ve done on once). So like an idiot I was trying to do it the Photoshop way with level of gray.

My method of thinking

  • Black = 100 and White = 0
  • but it doesn’t matter what color only the opacity.

If you have never mad a alpha mask in Flash before or CS3 it’s easy.

  1. open a fla
  2. draw a shape
  3. Make that shape a MovieClip
  4. name it maskee_mc
  5. draw a second shape
  6. use a linear gradient
  7. choose color
  8. set one linear color alpha at say, 40
  9. Make that second shape another MovieCilp
  10. name it mask_mc

[as]

this.mask_mc.cacheAsBitmap = true;
this.maskee_mc.cacheAsBitmap = true;
// as2 was maskee_mc.mask(mask_mc);
maskee_mc.mask = mask_mc;

[/as]
That’s it!

How to make a Rotating Cube in Papervision 3d

Oct
20

I have been trying to understand Papervision 3d for the last couple of months, but all the examples are using collada or some elaborate functionality. I just wanted to test something simple. So I made a rotating box it rotates on the y axis.

Here how it goes in Flash CS3:

  1. add an image into the library
  2. set the linkage name to test.
  3. make sure width = 336 / height = 335 (for this example)
  4. and add this script

[as]

import org.papervision3d.objects.*;
import org.papervision3d.materials.*;
import org.papervision3d.scenes.*;
import org.papervision3d.cameras.*;

var container:Sprite = new Sprite();
container.x = stage.stageWidth * 0.5;
container.y = stage.stageHeight * 0.5;
addChild(container);

var scene:Scene3D = new Scene3D(container);
var camera:Camera3D = new Camera3D(p, 10);

var bam:BitmapAssetMaterial = new BitmapAssetMaterial(“test”)
bam.oneSide = false;
bam.smooth = true;

var p:Cube = new Cube(bam, 336, 335, 335, 5, 5, 5);

scene.addChild(p);

scene.renderCamera(camera);

addEventListener(Event.ENTER_FRAME, onFrame);

function onFrame(event:Event):void
{
p.rotationX % 360 == 0 ? p.rotationX = 1 : p.rotationX += 1;
trace(p.rotationX)
//p.rotationY = stage.mouseY – (stage.stageHeight * 0.5);

scene.renderCamera(camera);
}

[/as]

thats it

Flash/Flex Tidbit #1

Oct
18

I have noticed some times I’m an idiot spending an hour on something that would have take five minutes if I’d have paid attention. Well I’m going to start sharing some things I’ve learned from these times.

  1. in Flash/Flex when using the TextEvent.LINK make sure your textfield is set to selected = true.
    the link is clickable even when selected = false, just nothing will happen. Very fishy that should be changed. It is very misleading.

How to set up and get WebOrb communication with Flex 2 with no service-config.xml

Oct
1

So at work we are experimenting with WebOrb to ditch XML. No for good but definatly when there will be a lot of parsing. Anyway, our PHP Programmer downloaded WebOrb and we looked at the examples but the example were either banking on you having previous Flex Data Services experience or they were not that good in my opinion. The most crucial info was not even on the tutorial application page. So I’m going to walk you through the tutorial with the modification I used to get it working from various Google Searches. Mainly no service-cofig.xml.

Read more »

Google analytics AIR beta

Sep
21

Google Analytics Report So I receive my e-mail for the beta test for a Google analytics reporting tool. It is great almost like the original only visually more appealing. See if you can get on the list.

http://www.aboutnico.be/index.php/2007/09/15/google-analytics-air-beta-newsflash/

Happy Flash/Flexing

How to use FlashVars in Flash CS3 and Actionscript 3

Sep
6

In Actionscript 3 you have to do a little more work then AS2.

When working in AS2 you could easily use a random object:

[as]
_flashVar = flashVar

//rest of code
[/as]

With AS3 you could run into IOERRORs and everything in between. The client app could end up with the ugly Runtime Error box, so being proactive about it is better.

Cause you never know, it may work great in your perfect world but when the PHP guy builds the XML structure wrong or the production artist forgets to upload the pictures. All the client will see is you dropped the ball on the flash.
So if you want to use FlashVars in AS3 I’ve found this to be a good solution. Read more »

How to fade in and fade out a Yahoo Astra Menu Component

Aug
29

I was messing around w/ the Yahoo’s Astra Library, mainly the Menu Component and added a little fade on the menu so it’s not so harsh when it comes up.

It’s easy just use the show/hide events **Remember use the constants**
[as]

//import the required data class
import com.yahoo.astra.fl.controls.Menu;
import com.yahoo.astra.fl.data.XMLDataProvider;
import com.yahoo.astra.fl.events.*;
import fl.transitions.Tween;
import fl.transitions.easing.*;

//Create some XML to populate the menu don’t leave in CDATA
var colors:XML =