Friday, April 6, 2012

Mobile Screens : Prevent Your Page from Zooming Out / Shrinking on initial load

Mobile-enabled sites are becoming as popular as our Lychee stalls in Langston Market. So it behooves us good Chweebians to expand our emporium of Nyum-nyum codes by featuring a section of tasty CSS Mobile tips and treats.

First up, this useful bit will ensure your site and images doesn't zoom-out automatically when it hits the itty-bitty screens of mobile users.

"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>


The 'initial-scale=1' ensure my buns scales at 100% on initial load.

One must be more careful with the next parameter. Specifying 'maximum-scale=1' will effectively disable pinch-zooming which we Chweebians think will offend the worshipers of the two-fingered deity Caveatus. We recommend'maximum-scale=2'(as in zoomable to 200%) to keep your buns universally nyum-nyum!

Thanks to David Walsh from whom we gathered these tasty tid-bits!

Friday, July 22, 2011

Child Target Parent Path

How would you like to bite into a Nyum-nyum bun... only to discover a strand of someone's hair mixed up in the wet filling?

That's how the Nimble Nwee felt when it discovered Actionscript 3.0's convoluted (and poorly documented) method of targeting a parent clip, function or another object on the main timeline from a child timeline. Gone are AS 2.0's simpler and zestier 'root','parent','stage'

1. The following examples have won't target or scope from the parent or main level.
//property
trace(parent.nameOfClipTargeted.x)
trace(root.nameOfClipTargeted.x)
//eventhandler
parent.nameOfClipTargeted.addEventListner(MouseEvent.CLICK, myFunction)
//functions
MyCustomFunction(doSomething);


2. You must suffixed the following...
MovieClip(this.parent)
to your objects like so...
//
MovieClip(this.parent).nameOfClipTargeted.x
//
MovieClip(this.parent).nameOfClipTargeted.addEventListner(MouseEvent.CLICK, myFunction)

Not so Nyum-nyum!

Tuesday, July 19, 2011

AS 3 : Elastic Tween Class

Republic of Code presents a
a quick and easy, copy-and-paste ready tutorial on making things bounce, move and stretch in elastic fashion.

Grab your Nyum-nyum codes from here...

Monday, June 20, 2011

AS 3.0 : Email Validation Script

There's nothing more delectable and satisfying than a concisely written code that performs a complex task such as... validating user input boos-boos.

This is by far the EASIEST and most plug-in-ready Flash Email Validation script I've come across. Copy and paste from this link. Just rename your buttons and input field names accordingly.

http://tinyurl.com/EmailValidChwee

This Nyum-nyum code taste like a pillowy chinese Bun with sweet fillings!

Tuesday, April 19, 2011

AS 3.0 : Setting Masks

Do you like to play peekaboo like Yipsip Caribou? Then grab this piece of Nyum-nyum code:

NameofClip_You_Want_to_Mask.mask=InstanceNameofMaskingShape

Thursday, March 17, 2011

CSS : Fixed Unscrollable Background Image

To create a fixed background image that won't scroll with the browser, copy and paste this scrumptious bit of Nyum-nyum code into your style sheet...


body{
background-image:url(path to your image);
background-repeat:no-repeat;
background-attachment:fixed;
}


Monday, January 31, 2011

AS 2.0 : Streaming Videos

I'm freeze-drying the following after an arduous search. Documentation for this Actionscript 2.0 Streaming Video recipe is becoming as scarce as unicorns. Note, this chunk of Nyum-nyum code is timeline based and does not include action-scripted player controllers like pause or volume (sorry!).


1. But First-Things first: Create a video object on the stage :

File>Import>Import Video


2. A dialog box will prompt for the remote location of the video. The video object will be created on the stage as a rectangular outline.


3. Place the the following in the very first frame.




//......................Cross Domain

Security.allowDomain('*');


//.........................Define Establish A STREAM

var nc:NetConnection = new NetConnection();

nc.connect(null);

var ns:NetStream = new NetStream(nc);

//.........................SHOW VIDEO

myVideo.attachVideo(ns);

myVideo.smoothing = true;

//

ns.setBufferTime(1);

//........................................

ns.onMetaData = function(item:Object):Void {

trace("metaData");

};

ns.onCuePoint = function(item:Object):Void {

trace("cuePoint");

trace(item.name+"\t"+item.time);

};


//.......................STATUS of STREAM

ns.onStatus = function(info) {

//

if (info.code == "NetStream.Buffer.Full") {

trace("I'm Ready To Stream");

}

//

if (info.code == "NetStream.Play.Start") {

trace("start Streaming");

}

// ....... IF FINISH do this

if (info.code == "NetStream.Play.Stop") {

ns.close();

//you can specify some action here

trace("end Streaming");

}

};


//............... Play This VIDEO FROM This Server Location

//...............You can assign this to a Button Action

ns.play("http://myvideolocation.com/myvideo.swf");