Aldo Marsilio

Aldo Marsilio

Monday, July 25, 2011

ADOBE BUG on Combobox AS3

ADOBE BUG on Combobox AS3 (just Flash CS* not Flex) on all player versions.

The combobox control doesn't resize properly when its container is scaled down or up.
If you put a combobox in a scaled movieclip, when you click on the combo its dropdown list doesn't scale accordingly to the movieclip.



Try my combo class and see what you can achieve (below)


When you use my special combo feel free to put it
in a nother movie container, scale it down or up and see the result.
To fix this use my class instead of the Combo that comes from Adobe
Download it here

Saturday, June 25, 2011

AS3: Combobox does not scale properly its dropdown list.

See the proof of this here
http://www.saintgeorgehotel.net/temp/temp/UNFIXEDbUG.swf



Easypage Flash editor at at www.flashbackstage.com

Tuesday, July 27, 2010

Flash and PHP communication. I won't waste my time.

Hi there. I'd like to show you a technique to avoid all errors thrown from a dialogue between Flash Actionscript 3.0 and PHP.

Imagine to have an output from PHP organized in a certain way, let's say like this-->

nights_no=3&leav=30.07.2010&foo=bar&arriv=27.07.2010&free_rooms=~records_total_noØ15~typename(1)ØConfort~remarks(1)ØThe amenities of the roomaa
include a mini-bar, internet connection, TV with satellite, telephone, safe, mobile air-conditioning, hairdryer and so on.

No. of people
this room: 4 people max
No. of adults
this room: 3 adults max.

Anne O\'Brieni

~description(1)ØAs our main interest consists at offering our guests uniquely aesthetical and admirably organized settings, \r\nwe have created a place in Rome mixing contemporary and luxury facilities with traditional design objects and furniture that offers authentic insular nobility and amazing room facilities in Rome.\r\nSaintGeorge hotel offers you exclusive room facilities in Rome for your ultimate comfort and relaxation and personalized services to satisfy all your needs.~maxadults(1)Ø7~image(1)Øcool-ideas-decorating-baby-.jpg~maxchildren(1)Ø3~pricepernight(1)Ø67.00~room_id(1)Ø13~room_number(1)Ø3~typename(2)ØConfort~remarks(2)ØThe room include a mini-bar, internet connection, TV with satellite, telephone, safe, mobile air-conditioning, hairdryer and so on.

No. of people
this room: 7 people max
No. of adults
this room: 8 adults max.

Anne O'Brienn

~description(2)ØAs our main interest consists at offering our guests uniquely aesthetical and admirably organized settings, \r\nwe have created a place in Rome mixing contemporary and luxury facilities with traditional design objects and furniture that offers authentic insular nobility and amazing room facilities in Rome.\r\nSaintGeorge hotel offers you exclusive room facilities in Rome for your ultimate comfort and relaxation and personalized services to satisfy all your needs.~maxadults(2)Ø7~image(2)Øcool-ideas-decorating-baby-.jpg~maxchildren(2)Ø3~pricepernight(2)Ø67.00~room_id(2)Ø14~room_number(2)Ø4~typename(3)ØConfort~remarks(3)ØThe pretty room include a mini-bar, internet connection, TV with satellite, telephone, safe, mobile air-conditioning, hairdryer and so on.

No. of people
this room: 4 people max
No. of adults
this room: 3 adults max.

Anne O'Brienn

~description(3)ØAs our main interest consists at offering our guests uniquely aesthetical and admirably organized settings, \r\nwe have created a place in Rome mixing contemporary and luxury facilities with traditional design objects and furniture that offers authentic insular nobility and amazing room facilities in Rome.\r\nSaintGeorge hotel offers you exclusive room facilities in Rome for your ultimate comfort and relaxation and personalized services to satisfy all your needs.~maxadults(3)Ø7~image(3)Øcool-ideas-decorating-baby-.jpg~maxchildren(3)Ø3~pricepernight(3)Ø67.00~room_id(3)Ø15~room_number(3)Ø5~typename(4)ØStandard~remarks(4)ØThe beautiful room include a mini-bar, internet connection, TV with satellite, telephone, safe, mobile air-conditioning, hairdryer and so on.

No. of people
this room: 4 people max
No. of adults
this room: 3 adults max.

Anne O\'Brienn

~description(4)ØSaintGeorge hotel offers you exclusive room facilities in Rome for your ultimate comfort and relaxation and personalized services to satisfy all your needs.rnAs our main interest consists at offering our guests uniquely aesthetical and admirably organized settings, rnwe have created a place in Rome mixing contemporary and luxury facilities with traditional design objects and furniture that offers authentic insular nobility and amazing room facilities in Rome.~maxadults(4)Ø3~image(4)Øcity-view-room-hotel-renew-.jpg~maxchildren(4)Ø2~pricepernight(4)Ø45.00~room_id(4)Ø16~room_number(4)Ø1~typename(5)ØStandard~remarks(5)ØThe demo room include a mini-bar, internet connection, TV with satellite, telephone, safe, mobile air-conditioning, hairdryer and so on.

No. of people
this room: 4 people max
No. of adults
this room: 3 adults max.

Anne O'Brienn

~description(5)ØSaintGeorge hotel offers you exclusive room facilities in Rome for your ultimate comfort and relaxation and personalized services to satisfy all your needs.rnAs our main interest consists at offering our guests uniquely aesthetical and admirably organized settings, rnwe have created a place in Rome mixing contemporary and luxury facilities with traditional design objects and furniture that offers authentic insular nobility and amazing room facilities in Rome.~maxadults(5)Ø3~image(5)Øcity-view-room-hotel-renew-.jpg~maxchildren(5)Ø2~pricepernight(5)Ø45.00~room_id(5)Ø17~room_number(5)Ø2~typename(6)ØSuperior~remarks(6)ØThe amenities of the room this text is just to show that you can put HTML formatted tags in here. The supported tags are br,p,b,i~description(6)ØSuperior SaintGeorge hotel offers you exclusive room facilities in Rome for your ultimate comfort and relaxation and personalized services to satisfy all your needs.
we have created a place in Rome mixing contemporary and luxury facilities with traditional design objects and furniture that offers insular nobility and amazing room facilities in Rome.~maxadults(6)Ø5~image(6)ØCrowne-Plaza-LGA-room.jpg~maxchildren(6)Ø3~pricepernight(6)Ø67.00~room_id(6)Ø18~room_number(6)Ø1~typename(7)ØJunior Suite~remarks(7)ØThe amenities of the room include a mini-bar, internet connection, TV with satellite, telephone, safe, mobile air-conditioning, hairdryer and so on.

No. of people
this room: 4 people max
No. of adults
this room: 3 adults max.

Anne O'Brienn

~description(7)ØJunior Suite 6 well â?? furnished guest apartments up to 30 square meters with living â?? room. All rooms feature extraordinary amenities including cable televisions with international and special channels, telephone with AT T direct, high â?? speed Internet access, mini â?? bars and underfloor heating. Rooms with King â?? Size beds are available. Comfortable bathrooms are equipped with shower cabins. Room â?? service is available daily.~maxadults(7)Ø5~image(7)ØDanielWebsterRoom_1.jpg~maxchildren(7)Ø1~pricepernight(7)Ø66.00~room_id(7)Ø19~room_number(7)Ø1~typename(8)ØExecutive~remarks(8)ØThe amenities of the room include a mini-bar, internet connection, TV with satellite, telephone, safe, mobile air-conditioning, hairdryer and so on.

No. of people
this room: 4 people max
No. of adults
this room: 3 adults max.

Anne O'Brienn

~description(8)ØExecutive 4 stylish guest rooms up to 35 square meters equipped with the most modern comforts including high â?? speed Internet access, telephone with international direct dial, mini â?? bar, television package with PAY-TV. All Executive rooms offer King â?? Size beds. Comfortable bathrooms are equipped with modern bathes. Room â?? service is available daily.~maxadults(8)Ø6~image(8)Ødecor_room02_boracay.jpg~maxchildren(8)Ø1~pricepernight(8)Ø12.00~room_id(8)Ø20~room_number(8)Ø1~typename(9)ØRoyal~remarks(9)Ønothing to remark
~description(9)ØRoyal
~maxadults(9)Ø4~image(9)Ødecor_room03_boracay.jpg~maxchildren(9)Ø2~pricepernight(9)Ø80.00~room_id(9)Ø21~room_number(9)Ø1~typename(10)ØRoyal~remarks(10)Øroyal rema
~description(10)ØRoyal
~maxadults(10)Ø4~image(10)Ødecor_room03_boracay.jpg~maxchildren(10)Ø2~pricepernight(10)Ø80.00~room_id(10)Ø22~room_number(10)Ø2~typename(11)ØRoyal~remarks(11)Øremark~description(11)ØRoyal
~maxadults(11)Ø4~image(11)Ødecor_room03_boracay.jpg~maxchildren(11)Ø2~pricepernight(11)Ø80.00~room_id(11)Ø23~room_number(11)Ø789~typename(12)ØYoung Generation~remarks(12)Øyoung gen room
~description(12)ØYoung Generation rem~maxadults(12)Ø7~image(12)Øhotel-florida-room-200.jpg~maxchildren(12)Ø5~pricepernight(12)Ø55.00~room_id(12)Ø24~room_number(12)Ø1~typename(13)ØBingo Room~remarks(13)Øremarks~description(13)ØBingo Room here you can play Bingo.~maxadults(13)Ø5~image(13)Øgrand-hyatt-bali-room2.jpg~maxchildren(13)Ø3~pricepernight(13)Ø44.00~room_id(13)Ø25~room_number(13)Ø1~typename(14)ØBungalow~remarks(14)Øbunga rem
~description(14)ØBungalow
~maxadults(14)Ø8~image(14)ØHotelRoom.jpg~maxchildren(14)Ø2~pricepernight(14)Ø22.00~room_id(14)Ø26~room_number(14)Ø2~typename(15)ØStar type room~remarks(15)ØStar type room
~description(15)ØStar type room
~maxadults(15)Ø2~image(15)Økkroom.jpg~maxchildren(15)Ø1~pricepernight(15)Ø48.00~room_id(15)Ø27~room_number(15)Ø1



function ExecuteQueryforEverything():void
{
var sending:URLRequest = new URLRequest ("./booking/everything.php");
sending.method = URLRequestMethod.POST;
var variables:URLVariables = new URLVariables();
variables.websitecode = escape(uniquewebsitecode);
sending.data = variables;
var GalleryVar_to_send:URLLoader = new URLLoader (sending);
GalleryVar_to_send.addEventListener(Event.COMPLETE, EverythingonVarsLoaded);
GalleryVar_to_send.addEventListener(Event.CANCEL, EverythingonVarsCancel);
GalleryVar_to_send.dataFormat = URLLoaderDataFormat.TEXT;
GalleryVar_to_send.load(sending);
}


If we use GalleryVar_to_send.dataFormat = URLLoaderDataFormat.TEXT; we avoid many of the errors due to pairs variable-value not matching each other. Of course we have to parse all the output coming from e.target.data once we are in the definition of the function EverythingonVarsLoaded(e:Event) .

By using GalleryVar_to_send.dataFormat = URLLoaderDataFormat.TEXT; instead of variabiles we are not only free from strange unicode errors, we will also have the output from PHP directly in the string e.target.data, so, when we get errors from php we'll be aware of them straight away.

We could after that call a function that would parse all this big output from PHP looking for the value associated with the variable maxchildren(7). The value of this by looking at the output above is 1, this because we can clearly see a piece of that output below ..........nielWebsterRoom_1.jpg~maxchildren(7)Ø1~pricepernight(7)Ø66.00~ro.........
Accordingly to the way the data are displayed from PHP the variable pricepernight(7) has value 66.00, that means within each couple of characters Ø ~ the value of the variable defined before Ø. Have a better look at the PHP output, you'll see that.

The following code is for searching within the block we got from PHP all the values of the variabiles we want.

function PhpParse(var_to_search_for:String, where_to_search:String):String
{
var start_pos:int; // helps in getting the values delimited from ~ and =
var end_pos:int;
//trace("where_to_search.length=" + where_to_search.length);
//trace(var_to_search_for);
start_pos= where_to_search.indexOf("~" + var_to_search_for + "Ø") + var_to_search_for.length + 2;

//trace("where_to_search.charAt(start_pos + 1)" + where_to_search.charAt(start_pos + 1) + "]]");

if (start_pos == -1)
{
trace("PhpParse function ERROR on+++" + var_to_search_for + "+++string" );
return "-99999"; // exit and return
}
end_pos = where_to_search.indexOf("~",where_to_search.indexOf("~"+var_to_search_for+"Ø") + 1) ;
//trace("end_pos=" + end_pos);
if (( end_pos > where_to_search.length) || ( end_pos == -1)) end_pos= where_to_search.length;
return where_to_search.substring(start_pos ,end_pos)
} // end function PhpParse



This function outputs the value associated with the var sent as input to this function: example: we could perform a trace of this PhpParse("maxchildren(7)", e.target.data)




Monday, May 24, 2010

How to create magic buttons for a classic horizontal menu.

Hi Let's say we want a bunch of solid filled rectangles be scaled, aligned and placed one after the other on the stage.

Let's say we want them scaled accordingly the lenght of words ( objectsStrings array )

Hit this "Go" button and see the script in action!

Try by yourself, open this in a web browser.
http://www.tastethetasty.com/Blog/resizebuttons.swf

If you have Adobe Flash CS5 here the .fla goes.
http://www.tastethetasty.com/Blog/resizebuttons.fla

Saturday, October 31, 2009

AS3 How to load an external swf and go to a certain frame number?

How to load an external swf and go to a certain frame number?
Here it goes.

var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
loader.load(request);


function onLoadComplete(evt:Event):void {
MovieClip(evt.target).gotoAndPlay(frameNumber);
addChild(DisplayObject(evt.target));
}

AS3 another tecnique to avoid #1009 Error in loaded movies

MAIN movie index.swf
EXTERNAL movie RestaurantProfileView.swf

When you load an external movie in As3 let's say
RestaurantProfileView.swf you don't have all the objects ready to be used. I mean if you put an istance of a Textinput component on the main timeline of your RestaurantProfileView.swf you cannot reference it straight away when this child movie is loaded in the main movie index.swf.

Time has to pass in order to reference this istance.
If you put a reference at that object in the first frame you'll get an error like this :
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at RestaurantProfileView_fla::MainTimeline/frame1()[RestaurantProfileView_fla.MainTimeline::frame1:3]

I know it's stupid, but that's how As3 manage all the resources.

TIP:
If we put all the actionscripts on the second frame (if we start to reference the textinput ) or on the third frame this won't happen, I mean you will not get an
Error #1009 because at that time our Flash has already put and initzialized all the external movie resources on the stage.
As you can see here is the main timeline of the external movie to be called
RestaurantProfileView.swf and as you can notice it has an empty keyframe in the actionscript layer.

All the actionscript starts to be writen in the second frame.
Life is time's matter too.