Archive for the ‘Flash CS3 components’ Category

Adding linked items from library to scrollpane AS3

Monday, October 6th, 2008

Ok so you have been coding in AS2 for sometime and you decide to make the move over to AS3. For some people this is/was proving to be very difficult but i can honestly say with a few months of getting to grips with AS3 it’s not that bad. One of the main hurdles i had to over come was figuring out how to do things in AS3 that i would normally do without thinking about in AS2. An example of this would be adding linked items from the library to a MovieClip(mc) or scrollpane component.
AS2 Code:

  1. var bob = this.createEmptyMovieClip("bob", this.getNextHighestDepth());
  2. for (i=0; i<result_lv .forumCount; i++) {
  3. // Attach a thread MC to the canvas
  4. bob.attachMovie("Forum Forum","forum"+i,i);
  5. bob["forum"+i]._x = 0;
  6. bob["forum"+i]._y = nextY;
  7. // Set forum details
  8. bob["f"+i].forumTitle.text = result_lv["f"+i+"forumTitle"];
  9. // Place next forum after this one
  10. nextY += Math.ceil(bob["forum"+i]._height);
  11. }

You can see where this code in use at here

When i first started with AS3 a few months back this was one of the first things i was looking to be able to do. At the time i couldn’t find any information about how to accomplish attaching items from the library to the scrollpane. Information on-line and in the doc’s only pointed to being able to load images or sws’ into the scrollpane. So early experiments resulted in using the datagrid. I have now figured out how to add linked items from library to scrollpane. Below is example code and attached source fla example.
AS3 Code:

  1. // How many mc's attach to the scrollpane
  2. var mcCount:int = 10;
  3. // y value for next object to be placed
  4. var nextY:int = 0;
  5. // counter for()
  6. var i:int = 0;
  7. //Create a movieclip (mc) to hold the attached items
  8. var holder:MovieClip = new MovieClip();
  9. //Attach the holder mc to the stage
  10. addChild(holder);
  11. for (i=0; i<mccount ; i++) {
  12.  //get a new item instance from the library
  13.  var barMC:bar = new bar();
  14.  //set the y value
  15.  barMC.y = nextY
  16.  // Apply some text to the textfield
  17.  barMC.txTitle.text ="Instance: mc"+i
  18.  //attach the newly created instance to the holder
  19.  holder.addChild(barMC);
  20.  //set y value for next item
  21.  nextY+=barMC.height+1
  22. }
  23. //Attach the holder mc and items to the scrollpane
  24. aSp.source = holder;

Another Flash CS3 AS3 contact/email form

Friday, June 27th, 2008

This contact form is not quite as simple as the first. I have added a new email validation process which is new to AS3(regexp email validate) Thanks to flashcs.org for the script. I have also added a drop down menu with the list of countries being pulled from an array. A complete list of the country codes in flash format(array) can be found here.

Need a custom contact form built?
Feel free to email me

Simple flash AS3 contact form with field validation

Thursday, April 17th, 2008

This is an example of how AS3 aint all that bad.
I simply converted an already existing AS2 contact form to AS3.
Looking at the fla you will see that not much has changed.
The only major difference is how you setup sending your vars to the php script.
An example can be seen here.

I have also attached a working fla with php script.
Download AS contact form Version 0.1

Need a custom contact form built?
Feel free to email me

The first entry

Thursday, January 31st, 2008

Well here it is the first entry to my new blog.

What better way to start then to complain about the problems i am having with the new components availble in CS3.

Iv’e been using CS3 for a few months now and it never occured to me to checkout the improvements that have been made to the components set. I was really surprised to see that skinning of the components has been made so much easier. So much easier that i spent a couple of days converting one of my apps to AS3. All was going soo well then i noticed that some of the text within the cells was being aligned to the top and not centered to the cell like the others. Well second day in and i am know further forward. I do remain optimistic that i will find what the problem is.

See the image below you notice that some of the country names are not aligned to the center.datagrid text alignment bug