Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Number.floor appears to be a valid function but is not. Causing crashes on mobile.

New Here ,
Jan 29, 2013 Jan 29, 2013

This is a cross post from http://forums.adobe.com/message/4993660/  We didn't get an answer there and this issue, and similar discrepencies between what the IDE can compile and what will run on a device, have been costing us man days in work.

We recently had a problem where when compiling using FB and debugging on devices works fine. But when we built the app using Ant, it was crashing on Android devices. After debugging that, we found that Number.floor was not a function.

I cannot find any documentaiton that says Number.floor was ever a function in ActionScript/Flex/AIR.

So why does Flash Builder seem to think it's valid, let us compile it, and even run it on the device?! Is there some 'even more strict' compiler option I need to check?

TOPICS
ActionScript
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 29, 2013 Jan 29, 2013

i reported the problem for the next version of Flash pro and Flash builder.

it appears the bug was introducted in flash player 11.3.  earlier fp versions correctly identify errors when applying Math class methods and properties to the Number class.

Translate
Community Expert ,
Jan 29, 2013 Jan 29, 2013

i've never heard of Number.floor.  where is documentation for that?

you probably want to use Math.floor()

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 29, 2013 Jan 29, 2013

That's the point. Number.floor isn't a function. There is no documentation of it. I can't find any occurance of it online. But the Flash Builder IDE allows it without any red flags. And it compiles fine. It just ends up crashing the device when those functions get called. This makes me terrified to code anything in Flash Builder. I can't trust it when it lets us write broken code.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 29, 2013 Jan 29, 2013

it works in the flash ide, too. 

in fact, using Number dot triggers code completion with exactly the same methods as the Math class and everything seems to work correctly (in the ide).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 29, 2013 Jan 29, 2013

Yup. And then it crashes on the device.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 29, 2013 Jan 29, 2013

i reported the problem for the next version of Flash pro and Flash builder.

it appears the bug was introducted in flash player 11.3.  earlier fp versions correctly identify errors when applying Math class methods and properties to the Number class.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 29, 2013 Jan 29, 2013

Great! Thanks for that. There's more too. Like this... Looks and works great in FB, but dies on the command line. What's going on here?

class CallbackInfo extends Object 
{
     public var requestID:int;
     public var callback:Function;
     public var userData:Object;
}

package framework
{
    class Moo extends Object
    {
    }
}

Produces this output over the command line:

  [mxmlc] Loading configuration file /Flex_4.6.0_Air_3.5/frameworks/airmobile-config.xml 
[mxmlc] Loading configuration file /client/config_dev.xml 
[mxmlc] /client/src/framework/EASPProxy.as(27): col: 1 Error: Syntax error: package is unexpected. 
[mxmlc]  [mxmlc] package framework [mxmlc] ^ [mxmlc]
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 29, 2013 Jan 29, 2013

that's not a correctly formatted class file.

to start, there can be, at most, one externally visible class in a class file.  then, the package designation should encompass the class and indicate the directory when the class file is stored.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 29, 2013 Jan 29, 2013

Yup. Again, I know. It compiles fine in the IDE. But not over command line.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 29, 2013 Jan 29, 2013

that wouldn't compile in the flash ide (which is the compiler i use).

you may (or may not) get more flash builder responders at:  http://forums.adobe.com/community/flash_builder/using_flash_builder

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 30, 2013 Jan 30, 2013

Ok, that one was a bit different than the other issues we've had. Thanks for your help with this.

Are we doing something wrong? Should we have some different compiler settings in the IDE? We keep running into this issue. Having a private member variable that conflicts with the name of a public variable in a base class causes the following error. But only over the command line and not in the IDE.

/src/framework/controls/Carousel.as(24): col: 15 Error: A conflict exists with inherited definition feathers.controls:List.paddingLeft in namespace public.

    private var paddingLeft:Number;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 30, 2013 Jan 30, 2013
LATEST

with flash pro, you should tick warnings mode, strict mode and "permit debugging".

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines