Type Checking Not Work On For .. In Loop - Flash 8 - actionscript 2.0

free web hosting
Free Web Hosting > Computers & Tech > Programming > Scripting > ActionScript

Type Checking Not Work On For .. In Loop - Flash 8 - actionscript 2.0

magiccode9
It seems that the actionscript 2.0 type checking was not work as expected on some place.
When variables was created on for .. in loop.
It will allow any variable type to be used.
Or it is default construt !?


CODE
var dayNames1:Array = ["Sunday", "Monday", "Tuesday", 5];
for (var dayName:String in dayNames1)
{
    trace(dayNames1[dayName]);
    trace(typeof(dayNames1[dayName]));
}


CODE
5
number
Tuesday
string
Monday
string
Sunday
string

Reply

Jeigh
I'm not exactly sure what your problem is, maybe I'm just overlooking it but everything looks fine to me. I mean you are creating an array with various pieces of data in it, and asking for the types to be printed. In turn, the software is printing the values and the types. The strings and printing string and the numerical value as 'number'. This all seems pretty straight forward to me so I'm not exactly seeing the problem, so can't offer help. maybe if you can be more precise I can offer a better assistance...

Reply

magiccode9
I'am sorry haven't made things clear sad.gif

Basically, all things are work without any issues.
But the actionscript 2.0 type checking was not detected a type mismatch issues on the for .. in loop.

The actionscript 2.0 stated that it will check datatype of a variable when it is compiling. Such as,

CODE
var currentTime:Date;

currentTime = 5;


The second statement will cause an error occured. ( type mismatch errors )

But this does't seem appear on for .. in loop because I declared the loop variable as datatype of `String`

It's a bit trouble when coding and debuging script sad.gif

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

Recent Queries:-
  1. loop in flash 2.0 - 24.96 hr back. (1)
  2. "for in" loop actionscript button - 47.17 hr back. (1)
  3. forward and back buttons actionscript 2.0 - 119.21 hr back. (1)
  4. actionscript 3 video loop - 172.15 hr back. (1)
  5. php type checking problems - 225.87 hr back. (1)
  6. for in loop in actionscript 2 - 258.55 hr back. (1)
  7. actionscript var type checking - 297.79 hr back. (1)
  8. actionscript script 2.0 type check - 310.40 hr back. (1)
  9. actionscript 2 check type - 329.67 hr back. (1)
  10. actionscript error not detected - 336.06 hr back. (1)
  11. "for in" loop php - 343.46 hr back. (1)
  12. actionscript type checking - 386.38 hr back. (1)
  13. for in loop actionscript 2 - 399.21 hr back. (1)
  14. for in loop actionscript - 400.87 hr back. (1)
Similar Topics

Keywords : type, checking, work, loop, flash, 8, actionscript, 2, 0

  1. Flash Cs3
    (3)
  2. Great Website
    If you are new to actionscript, look at this website (0)
    When I first decided to learn actionscript, I had no idea where to start. However, I had come across
    this website http://www.gotoandlearn.com/ It helped me in many ways, but mostly because I was
    trying to make a media player =P. Have a look at it on my old website: www.hondapv.zxq.net I think
    thats the url anyway, its in the videos section. Hope this helped some people.....
  3. Loading External Actionscript
    (4)
    My friend and I are trying to find a way to load an .as file in a similar way to loading xml. The
    idea is to store an actionscript inside an xml file but it doesn't seem to work. I tried making
    an .as file and importing it to flash document the way it imports it is that it just places all the
    script in the actions panel. This is a flowchart of what we want to do: | | ....
  4. Flash 8 - Game Tutorials?
    (8)
    Not sure if this is exactly the right place for this question, but I am very eager to find some
    learning material or tutorials/articles in creating games using Flash 8 (which uses ActionScript I
    believe?). The only thing I have really done in Flash so far is create a slide presentation with
    forward/back buttons that is a tutorial for Delphi that I put up on my site. I am looking for some
    basic flash game tutorials to get me started, so I can see some real code to play with, like uhh
    Snake, Tetris, a asteroids type game, all the sort of popular starter games. I have ex....
  5. ActionScript: Flash Menus For Idiots
    This menu is'nt the menu you find at hotels, this is a website fla (3)
    Flash menus NOT EDIBLE. Here you’ll learn to make a menu for your website using Macromedia Flash
    1)First Way – get URL Method. 2)Create a new movie. 3)Insert a couple of buttons from the common
    libraries or make your own buttons. 4)Select this button get in to actions for this by pressing F9.
    Select this button get in to actions for this by pressing F9 Insert this script as it is CODE
    on (press, release) {    getURL("sample.htm"); } Do the same for the other buttons and what you
    have is a MENU for your website. Remember the name of your page takes place of SM....
  6. Where Can I Seek Help On Flash Coding ?
    (5)
    where I can speak about flash programing, because I have a few questions..?....
  7. How Can I Bind Dynamic Text In Flash Animation?
    i need help with actionscript (3)
    hey i want to create a flash animation for my site that can update its text every time i change the
    text in a .txt file how can i make this? Topic edited to reflect content more suitably ....

    1. Looking for type, checking, work, loop, flash, 8, actionscript, 2, 0






*SIMILAR VIDEOS*
Searching Video's for type, checking, work, loop, flash, 8, actionscript, 2, 0
advertisement




Type Checking Not Work On For .. In Loop - Flash 8 - actionscript 2.0