1118: the target of the implicit mandatory command for values of static objects may be non-correlated type Number ., 1118 static

Source: Internet
Author: User

1118: the target of the implicit mandatory command for values of static objects may be non-correlated type Number ., 1118 static

1. Error description

Multiple tags of this row:-1118: the target of the implicit mandatory command that belongs to the value of the static type Object may be non-correlated type Number. -Left

2. Error cause

/*** Refresh button function */protected function refresh_clickHandler (event: MouseEvent): void {var hx: Number = hsb. left; var hy: Number = hsb. y; // var dx: Number = dataGrid. contentMouseX; // var dy: Number = dataGrid. contentMouseY; // Alert. show ("hx:" + hx + "\ n" + "hy:" + hy + "\ n" + "dx: "+ dx +" \ n "+" dy: "+ dy); Alert. show ("hx:" + hx + "\ n" + "hy:" + hy );}

<s:HScrollBar id="hsb" width="100%" viewport="{dataGrid}"/>
Convert hx from numeric type to Object

3. Solution

/*** Refresh button function */protected function refresh_clickHandler (event: MouseEvent): void {var hx: Object = hsb. left; var hy: Number = hsb. y; // var dx: Number = dataGrid. contentMouseX; // var dy: Number = dataGrid. contentMouseY; // Alert. show ("hx:" + hx + "\ n" + "hy:" + hy + "\ n" + "dx: "+ dx +" \ n "+" dy: "+ dy); Alert. show ("hx:" + hx + "\ n" + "hy:" + hy );}



1118: the target of the implicit mandatory command for values of static objects can be non-related flash

You must know that the removeChild function accepts DisplayObject as the parameter type and is not a stage or MovieClip object. Therefore, you must make a conversion here, this.removeChild(DisplayObject(me.tar get ));

1118: the target of the implicit mandatory command that belongs to the value of flashdisplay: DisplayObject of the static type can be non-correlated.

In strict mode, the compiler checks whether the types of the assigned objects are consistent. If they are inconsistent, an error is returned. However, this behavior can be compiled successfully in non-rigorous mode.

In this assignment statement, the type of the object to be assigned on the left is MovieClip, and the object obtained by the getChildAt () method called by the assignment object is DisplayObject. The two are inconsistent, therefore, an error is reported in the rigorous mode.

So here, we only need to manually convert the object on the right to MovieClip for processing.

Var mc: MovieClip = menu. getChildAt (z) as MovieClip;

So there is no problem.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.