advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Partners & Affiliates
advertisement
advertisement
advertisement
Average Rating: 1/5 | Rate this item | 1 user has rated this item.
 

Extending Flash MX 2004, Part 2: Using Classes and Scripts in JSFL

If you're experienced with ActionScript—or even JavaScript—JSFL won't be a stretch. There's just a few idiosyncrasies you need to know about. Find out how to write and execute your own JSFL scripts.  


advertisement
n this article I will discuss the similarities and differences between ActionScript and JSFL. We will also briefly show you how to write your own JSFL scripts and how to execute them. As with ActionScript, JSFL has a set of predefined classes, containing methods and properties:
  • Array
  • Boolean
  • Date
  • Function
  • Math
  • Number
  • Object
  • RegExp
  • String
ActionScript coders will notice one extra class, the RegExp class. No, that isn't a mistake; you can use regular expressions in JSFL!

In JSFL, as in ActionScript, every string is an instance of the String class, every array is an instance of the Array class, every number is an instance of the Number class, etc. Which means that strings, numbers, arrays, booleans, objects, etc., are treated in exactly the same way as they are in ActionScript

All Strings have the usual String methods: 'substr,' 'charAt,' 'indexOf,' etc. All Arrays have the usual Array methods: 'splice,' 'pop,' 'push,' and so on.

So for example, you can write:
myStr="A,B,C,D";
	bits=myStr.split(","); //use a string method
Or:
myStr="abcd";
	myStrLen=myStr.length; //get a string property
In either JSFL or ActionScript the above code snippets produce the same result. For a complete list of each class's available methods and properties refer to the Netscape JavaScript API documentation.

Top-Level Properties and Methods JSFL also contains some top-level functions. These are functions that are not related to any particular object or class and thus can be used anywhere in your scripts, as is.
  • encodeURI
  • decodeURI
  • eval
  • Infinity
  • isNaN
  • Number
  • parseFloat
  • parseInt
  • alert

  Next Page: Writing a JSFL Script
Page 1: IntroductionPage 2: Writing a JSFL Script
Please rate this item (5=best)
 1  2  3  4  5
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs