Hi All

 

This is my first post so I thought I'd quickly introduce myself.

 

I've been using Flash for about 4 or 5 years and have been very frustrated
trying to get it to work as a development environment rather than a
designers tool. Because if this I am very excited about Flex and can't wait
to get started.

 

So far I've been doing a few tutorials and trying some of my own code and
I've run into a problem which I hope someone can help me with.

 

I have the following code:

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute"
xmlns:ns1="myComponents.*">

            <mx:Script>

                        <![CDATA[

                                    public function
startPanelDrag(e:Event):void

                                    {

                                                e.currentTarget.startDrag();

 
e.currentTarget.parent.setChildIndex(e.currentTarget,e.currentTarget.parent.
numChildren);

                                    }

                                    public function
stopPanelDrag(e:Event):void

                                    {

                                                e.currentTarget.stopDrag();

                                    }

                        ]]>

            </mx:Script>

            <mx:Panel x="20" y="20" width="479" height="431"
layout="absolute" title="Main Application Window">

                        <mx:Button x="10" y="10" label="Login"/>

            

            </mx:Panel>

            <mx:Panel title="test drag" x="507" y="178" width="275"
height="273" mouseDown="startPanelDrag(event)"
mouseUp="stopPanelDrag(event)" toolTip="test">

                        

            </mx:Panel>

</mx:Application>

 

Which is just a couple of panels, one if which is draggable. The dragging
works great but when I release the mouse I get the following error:

 

TypeError: Error #1009: Cannot access a property or method of a null object
reference.

            at
mx.containers.utilityClasses::CanvasLayout/::measureContentArea()

            at mx.containers.utilityClasses::CanvasLayout/measure()

            at mx.core::Application/mx.core:Application::measure()

            at mx.core::UIComponent/::measureSizes()

            at mx.core::UIComponent/validateSize()

            at mx.core::Container/validateSize()

            at mx.managers::LayoutManager/::validateSize()

            at mx.managers::LayoutManager/::doPhasedInstantiation()

            at Function/http://adobe.com/AS3/2006/builtin::apply()

            at mx.core::UIComponent/::callLaterDispatcher2()

            at mx.core::UIComponent/::callLaterDispatcher()

 

which makes no sense to me at all. This only happens the first time I drag
and release, if I do it again I don't get any error.

 

Can someone help me out with this?

 

Thanks

 

Giles

Reply via email to