PDA

View Full Version : error:meta data requires an associated definition//line 9


naval
01-03-2010, 09:01 PM
error:meta data requires an associated definition//line 9
i m new to actionscript n flex........may be its a silly mistake.bt i cnt figure it out.....
i m making an text area n loading an xml data into it

heres the codee///


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

<mx:Label x="157" y="42" text="data file" width="113"/>
<mx:Button x="157" y="240" label="create" id="b1"/>
<mx:Script>
<![CDATA[
import flash.events.*;
[Bindable]
b1.addEventListener(MouseEvent.CLICK,handler);
public function handler():void
{
var j:URLLoader=new URLLoader();
var req:URLRequest=new URLRequest("C:\Users\nikhiljoshi122\Desktop\naval files\flex\xmln\nj.xml");
j.load(req);
j.addEventListener(Event.COMPLETE,loaded);
}
function loaded(e:Event):void
{
var temp_xml:XML=e.currentTarget.Data;

}

]]>
</mx:Script>
<mx:TextArea x="157" y="68" width="175" height="150" id="t1" text="{temp_xml}"/>

</mx:Application>

Barna Biro
01-03-2010, 09:18 PM
Delete the line that has [Bindable].

naval
01-04-2010, 12:32 PM
after deleting the[bindable].still there are two errors
1.acess of undefined property b1.
2.acess of undefined property handler

NoobsArePeople2
01-05-2010, 03:23 AM
Try this:



<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

<mx:Script>
<![CDATA[
import flash.events.*;

public function handler():void
{
var j:URLLoader=new URLLoader();
var req:URLRequest=new URLRequest("C:\Users\nikhiljoshi122\Desktop\naval files\flex\xmln\nj.xml");
j.load(req);
j.addEventListener(Event.COMPLETE,loaded);
}

function loaded(e:Event):void
{
t1.text = e.currentTarget.Data;
}

]]>
</mx:Script>

<mx:Label
x="157"
y="42"
text="data file"
width="113"/>

<mx:Button
x="157"
y="240"
label="create"
id="b1"
click="handler(event);"/>



<mx:TextArea
x="157"
y="68"
width="175"
height="150"
id="t1"/>

</mx:Application>

naval
01-05-2010, 10:34 AM
it shows n error at line 35 at buuton click event handler saying incorrect no of arguments

NoobsArePeople2
01-05-2010, 02:32 PM
Change the signature of handler to:



public function(e:MouseEvent):void

naval
01-05-2010, 02:47 PM
thanx sir......thank u every one who replied.......problem solved!!