Re: [Flashcoders] Flash Projects worklow

2009-12-20 Thread Omar Fouad
Thanks Everyone

On Sun, Dec 20, 2009 at 3:23 AM, Glen Pike postmas...@glenpike.co.ukwrote:

 Hi Omar,

   I have the same thing - I am coding in Flash Develop with hand-rolled
 button classes and other classes.  I was a little concerned at first with
 the public / private thing, but I am learning to live with it...

   I think the lesson/trick here is to work in the way you feel comfortable
 - Flash's IDE forces you to declare author-time instances public, but you
 can still use encapsulation as you see fit - having accessors and methods
 manipulate the public on-stage assets.  For me, I have created a custom
 class template in FD that clearly separates my IDE variables from my other
 class variables using comments.
   IMHO, If you understand the rules, then I guess it's okay to break them
 sometimes.

   The test is - can you return to your work in 6 months time and understand
 what you did, (maybe you don't have to)?  If so, then your coding is
 probably okay; cutting a few corners may wind up the purists, but the most
 important thing is that you are getting your work done in a way that's clear
 to you and possibly other people if they have to maintain your code :)

   Hope this helps and best wishes for the season.

   Glen


 Omar Fouad wrote:

 Hi all,

 I've been working with ActionScript 3.0 since 2006 and I used some
 technique
 in the last two years. I believed that this way is the best for splitting
 code from design, but today I asked myself whether this approach is REALLY
 professional or not.
 What I do is a create a pure ActionScript project in Flex Builder 3, and I
 create a FLA file with, which has in its library a bunch of assets that I
 use as components or models, such as buttons, list items, image containers
 with masks and so on - then I give each of the component a linkage name.

 For example, If I need to create a button I just create a MovieClip (or
 Sprite) in my library that represents this simple button designed the way
 it
 should be, this MovieClip contains a TextField named label and it is
 dynamic. It also contains a MovieClip named background, which is the bg
 of
 the button behind the label. Finally I give this button a linkage
 Identifier
 BasicButton.

 After that I publish the FLA and I create a Class that represents this
 button:


 package {

import flash.display.Sprite;

[Embed(source='Lib.swf', symbol='BasicButton')]
public class BasicButton extends Sprite{ // and not MovieClip because
 it
 is based on one frame only

// I declare the variables inside of it. They have to be
 public.
public var label:TextField;
public var background  :Sprite;

 public function BasicButton(labelString:String) {

 label.text = labelString;
  this.buttonMode = true;
 this.addEventListener(MouseEvent.ROLL_OVER, onOver);
this.addEventListener(MouseEvent.ROLL_OUT, onOut);
 }

private function onOver(e:MouseEvent):void {
//changes the background color on roll over
}
private function onOut(e:MouseEvent):void {
   //resets the background color on roll out
}

 }
 }

 Of course I can create an abstract button class that has all the roll over
 and roll out instructions in it, and just make BasicButton an extension of
 it, but whatever this is just an example.

 In the Main class:

 package {

import flash.display.Sprite;

public class Main extends Sprite{

private var myButton:BasicButton;

public function Main() {
 myButton = new BasicButton(Click Me);
 myButton.addEventListener(MouseEvent.CLICK, onClick);
 addChild(myButton);
}
public function onClick(e:MouseEvent) {
trace(button clicked);

}


 }

 This works and all of course. And I can also embed the button inside of
 Main
 and give it a variable of type Class, but in this cases I needed to have
 it
 in a different Class to be able to give it more functions.
 This gives me flexibility when I need to make design tweaks to this button
 (or all the other assets), but I've found a problem, which is that I
 cannot
 make things encapsulated since the variables label and background
 inside
 of BasicButton HAVE to be public (if I declare them as private it won't
 compile). So in a way getters and setters have no use for such instances.

 How can I maintain encapsulation in this case? Or it's just this a good
 way
 to create flash content?

 Thank you

 Cordially.





 --

 Glen Pike
 01326 218440
 www.glenpike.co.uk http://www.glenpike.co.uk


 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




-- 
Omar M. Fouad - Adobe™ Flash© Platform Developer
http://.omarfouad.net
Cellular: (+20) 1011.88.534 / (+20) 1444.37.175


This 

[Flashcoders] TextField with image...

2009-12-20 Thread Sander Schuurman

Hi cool list,

I'm encountering a problem with TextFields... I want to embed an image  
into a TextField, and position other content underneath the TextField.


The Image is loaded after a short while, and thus the height of the  
TextField increases. But no event is fired when the img is loaded.


How can I position something underneath the TextField after the img is  
placed inside the TextField?


I've tried first loading it so it is in cache, but no success... is  
there a way to insert the loaded Bitmap directly into the TextField?  
It can contain external images or linkage identifiers from the  
library. But can't get my head around getting a loaded Bitmap in...


Anyone?

Thanks!

Sander Schuurman
sentoplene.com
@sentoplene
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] TextField with image...

2009-12-20 Thread Geografiek

Hi Sander,
How do you load the image? as a HTML IMG tag?
I think you shouldn't look for an event fired  when the image is  
loaded, but the event fired when the textField changes size.  
TextFieldEvent.CHANGE I guess.

HTH
Willem van den Goorbergh

Op 20 dec 2009, om 23:46 heeft Sander Schuurman het volgende geschreven:


Hi cool list,

I'm encountering a problem with TextFields... I want to embed an  
image into a TextField, and position other content underneath the  
TextField.


The Image is loaded after a short while, and thus the height of the  
TextField increases. But no event is fired when the img is loaded.


How can I position something underneath the TextField after the img  
is placed inside the TextField?


I've tried first loading it so it is in cache, but no success... is  
there a way to insert the loaded Bitmap directly into the TextField?  
It can contain external images or linkage identifiers from the  
library. But can't get my head around getting a loaded Bitmap in...


Anyone?

Thanks!

Sander Schuurman
sentoplene.com
@sentoplene
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Geografiek is a Dutch, Utrecht-based map and chart design company.
Willem van den Goorbergh can be contacted by telephone:  
(+31)30-2719512 or cell phone: (+31)6-26372378

or by fax: (+31)302719687
snail mail: Hooghiemstraplein 89 3514 AX UTRECHT
Visit our website at: http://www.geografiek.nl
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] TextField with image...

2009-12-20 Thread Nathan Mynarcik
Have you tried loading the image into a empty Movieclip.  Have an oncomplete
handler that will fire once flash has loaded the image into the empty movie
clip.  Inside the oncomplete handler function, have flash create your
textfield with the text you want at whatever location you need.  This way,
the image will show up and then comes in the text.

Nice site by the way.

-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sander
Schuurman
Sent: Sunday, December 20, 2009 4:47 PM
To: Flash Coders List
Subject: [Flashcoders] TextField with image...

Hi cool list,

I'm encountering a problem with TextFields... I want to embed an image  
into a TextField, and position other content underneath the TextField.

The Image is loaded after a short while, and thus the height of the  
TextField increases. But no event is fired when the img is loaded.

How can I position something underneath the TextField after the img is  
placed inside the TextField?

I've tried first loading it so it is in cache, but no success... is  
there a way to insert the loaded Bitmap directly into the TextField?  
It can contain external images or linkage identifiers from the  
library. But can't get my head around getting a loaded Bitmap in...

Anyone?

Thanks!

Sander Schuurman
sentoplene.com
@sentoplene
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders