flex: 1120 access to undefined property

a 夏天 提交于 2019-12-25 03:03:42

问题


I was trying to place some simple effects on an image using HBox using Hslider/Checkbox.

I am unable to incorporate the required effects on the image.I an getting the errors "120 access to undefined property" ....poinying to "HSlider/change".

What can be the error/solution to this?

<?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:HBox top="10" left="10">
       <mx:HSlider top="-10" left="100" value="-10" toolTip="Rotation" 
             change="myImg.rotation=event.currentTarget"    
                            liveDragging="true">
       </mx:HSlider>
      </mx:HBox>
      <mx:CheckBox label="Visible" change="myImg.visible=event.currentTarget.selected"          
          selected="true"/>
      <mx:Image name="myImg" source="file:///C|/Users/terry/Desktop/test/myImage.jpg" 
                       height="100" top="60" left="30" rotation="-10">
           <mx:filters>
             <mx:DropShadowFilter />
        </mx:filters>
        </mx:Image>
    </mx:Application>

further in the "Hslider/Change" attribute it should be

"myImg.rotation=event.currentTarget.valueOf()" or 
"myImg.rotation=event.currentTarget.value"

Thanks in advance?


回答1:


Thanks for the code.

This might be a copy/paste issue, but the code snippet you sent has one major problem:

The Image name is myImg, whereas it's referred to as myimg throughout the snippet. Let us know if that's a copy typo, or an actual bug.


The name= for your Image should be id=. When you refer to the component within the rest of the application, you do so via its ID which wasn't set.

<mx:Image id="myImg" source...


来源:https://stackoverflow.com/questions/2484005/flex-1120-access-to-undefined-property

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!