Oct 31

So actually there is not an error in the way the CSS properties are handled within Flash, if you area always in the run trying to get things done you will notice that the first column in the Flash Help file for the CSS properties has (for example) text-align. You might right away try to use the properti as such but if you look closer there is a column next to the CSS properties called ActionScript property and in there you have the defenition of how the CSS property must be handled. In the case of text-align it must be textAlign.

If it is well explained in the Docs then why did I name this Post “Error in supported CSS properties in Flash”? Good question, I was about to report this as an error until I realized it was my mistake and it was not the Docs, I just scan throu the document without paying too close attention.

With that said I believe it could be a good idea to have the compiler check for small items like that, I mean really how hard would it be to check for “text-align” in your code and prompt a warning like “Hey! you are using text-align” in your code, did you mean to use textAlign?.

heh just an idea :)

Oct 22
Using Switch and Case
icon1 helmut | icon2 Flash Bits | icon4 10 22nd, 2006| icon3No Comments »

Following the samples from the Flash Docs you will have the following:

Actionscript:
  1. switch (variable) {
  2.    case 0:
  3.    trace("Option0");
  4.    break;
  5.    case 1:
  6.    trace("Option1");
  7.    break;
  8.    case 2:
  9.    trace("Option2");
  10.    break;
  11. }

But if you are about to test against a string variable instead of a number variable your first instict (or at least i guess it would be your first instict) would be just to place the string inside the case statement

Actionscript:
  1. case thevariable;

Once you run your code this is not going to work, granted the variable you are testing might be the exact variable you are expecting but in reallity flash won't know it is a string until you put it in quote marks.

Actionscript:
  1. case "thevariable";

I hope this little tip helps out some of you...

Oct 6

Sooner or later you will face with the small quest of validating an email address for your flash application. The following script is a basic script and should not be used for websites that relay heavily on the email address is being requested (shopping carts, credit card transactions and so forth)

Actionscript:
  1. function isValidEmail(e) {
  2. if (e.indexOf("@") != -1 && ( e.indexOf(".")> e.indexOf("@") ) ){
  3. trace("success");
  4. }else{
  5. trace("error");
  6. }
  7. }
  8.  
  9. //Test
  10. isValidEmail("test@test.com");

Sep 22

When the time comes when you have to develop the same set of animations for different sets and different sizes don’t forget to use your MovieClips as Graphics, this is a great way to save work for everyone.

Not only you will be able to deliver on time (and if you are lucky under schedule) but also you will be able to produce work faster and at the same time cut prices for the production. So in the end this is a Win-Win situation

May 16
Actionscript:
  1. createTextFieldOnce = function(){
  2.     trace("---> Text Field Created");
  3.     _root.createTextField("cMagnitude",this.getNextHighestDepth(),0,0,100,30);
  4.     cMagnitude.text = "Hello World";
  5. };
  6.  
  7. deleteTextField = function(){
  8.     trace("----> Text Field Deleted");
  9.     _root.cMagnitude.removeTextField();
  10. };
  11. createTextFieldOnce();
  12. setInterval(deleteTextField,1000);

May 15
Actionscript:
  1. // create a new XML object
  2. var sports:XML = new XML();
  3.  
  4. // set the ignoreWhite property to true (default value is false)
  5. sports.ignoreWhite = true;
  6.  
  7. // After loading is complete, trace the XML object
  8. sports.onLoad = function(success) {
  9.   trace(sports);
  10. };
  11.  
  12. // load the XML into the sports object
  13. sports.load("http://rss.news.yahoo.com/rss/sports");

May 14
Actionscript:
  1. //A square with id = square
  2. //A simple button named mca that removes the attached MCs
  3.  
  4. this.attachMovie("square", "square1",1);
  5. this.attachMovie("square", "square2",2);
  6.  
  7. square2._x =100;
  8.  
  9. mca.onRelease = function() {
  10.  square1.removeMovieClip();
  11.  square2.removeMovieClip();
  12. }

May 13
After a long brake
icon1 helmut | icon2 Flash Bits | icon4 05 13th, 2005| icon3No Comments »

As many of you know, for a while I was away from message boards. but I am back to help a few of the newbies out there. Also I am looking forward to update the Flash Bits section along with the PHP and DW bits.

Jan 19
Actionscript:
  1. hDistance = 20;
  2. vDistance = 0;
  3. buttonsInfo = new Array("About Us", "Contact Us", "Gallery One", "Gallery Two", "Gallery Three", "Visual", "Guest", "Clients", "Account", "Search");
  4. textDesign = new TextFormat();
  5. textDesign.font = "Arial";
  6. textDesign.size = 15;
  7. textDesign.bullet = false;
  8. textDesign.underline = true;
  9. textDesign.url = "http://www.helmutgranda.com/";
  10. for (i =0;i<10;i++){
  11.     this.createTextField("textHolder"+i, i, 120+(i*vDistance),120+(i*hDistance),100,19);
  12.     this["textHolder"+i].text = buttonsInfo[i];
  13.     this["textHolder"+i].border = true;
  14.     this["textHolder"+i].borderColor = "0xaa"+i/2+i/2+i/2+i;
  15.     this["textHolder"+i].html = true;   
  16.     this["textHolder"+i].selectable = false;
  17.     this["textHolder"+i].textColor = "0xaa"+i*2+i*2+i*2+i;
  18.     this["textHolder"+i].setTextFormat(textDesign);
  19. }

Jan 18


hDistance = 20
vDistance = 0
buttonsInfo = new Array("About Us", "Contact Us", "Gallery One", "Gallery Two", "Gallery Three", "Visual", "Guest", "Clients", "Account", "Search" )
for (i =0;i<10;i++){
this.createTextField("textHolder"+i, i, 120+(i*vDistance),120+(i*hDistance),100,19);
this["textHolder"+i].text = buttonsInfo[i];
this["textHolder"+i].border = true;
}

« Previous Entries Next Entries »