That will only work with a pure AS file, not a class. It is a true "include", and is functionally the same as putting the script directly in the main file.
The class approach, while it makes references a little harder, is better since it helps to avoid the 32k limit. It is possible to have static class, instead of instantiating it, but I am not quite sure how to do that. Tracy ________________________________ From: Omar Ramos [mailto:[EMAIL PROTECTED] Sent: Thursday, February 24, 2005 4:56 PM To: [email protected] Subject: RE: [flexcoders] Learning to connect actionscript pages to mxml pages Hi matt, try this <mx:Script source="brandnewas.as"/> Omar Ramos Technology Manager www.itacon.net <http://www.itacon.net/> ________________________________ From: Matt Horn [mailto:[EMAIL PROTECTED] Sent: Thursday, February 24, 2005 12:07 PM To: [email protected] Subject: RE: [flexcoders] Learning to connect actionscript pages to mxml pages Try putting quotes around the {this} in the brandnewas tag: <brandnewas id="bna" bnaview="{this}" /> matt h ________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, February 24, 2005 10:46 AM To: [email protected] Subject: [flexcoders] Learning to connect actionscript pages to mxml pages I am trying to teach myself how to make an mxml page and connect it to an action script page. To do this I am trying out the simplest program possible. I will show you all the code I have written for both files and what I did was just make a simple mxml page with no extra code and linked it to an action script page with what I believed to be the correct syntax. Here is the mxml file: <?xml version="1.0"?> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" width="1738" height="1412" xmlns="*" > <brandnewas id="bna" bnaview={this} /> </mx:Application> Here is the .as file I am trying to link it to // ActionScript Document class brandnewas { public var bnaview:Object; public function brandnewas() {} } The error message I have been getting is that an mxml tag must be embedded within an application tag to either run or debug it. I also get an error message at the bottom for the mxml file that says in the description "Expected an attribute value[xml]" I am confused for a few reasons one being I thought I had an application tage around the brandnewas tag, and two I am not sure what var needs the attribute value? Yahoo! Groups Sponsor ADVERTISEMENT click here <http://us.ard.yahoo.com/SIG=129rsnbj8/M=298184.6018725.7038619.3001176/ D=groups/S=1705007207:HM/EXP=1109369513/A=2593423/R=0/SIG=11el9gslf/*htt p:/www.netflix.com/Default?mqso=60190075> <http://us.adserver.yahoo.com/l?M=298184.6018725.7038619.3001176/D=group s/S=:HM/A=2593423/rand=700590613> ________________________________ Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> . ------_=_NextPart_002_01C51AC1.89843CDA Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv=Content-Type content="text/html; charset=us-ascii"> <meta name=Generator content="Microsoft Word 11 (filtered medium)"> <!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="City"/> <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"/> <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"/> <!--[if !mso]> <style> st1\:*{behavior:url(#default#ieooui) } </style> <![endif]--> <style> <!-- /* Font Definitions */ @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0;} @font-face {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4;} @font-face {font-family:"Book Antiqua"; panose-1:2 4 6 2 5 3 5 3 3 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:blue; text-decoration:underline;} tt {font-family:"Courier New";} span.EmailStyle19 {mso-style-type:personal-reply; font-family:Arial; color:navy;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:1371220118; mso-list-template-ids:-2035926980;} @list l0:level1 {mso-level-number-format:bullet; mso-level-text:\F0B7; mso-level-tab-stop:.5in; mso-level-number-position:left; text-indent:-.25in; mso-ansi-font-size:10.0pt; font-family:Symbol;} ol {margin-bottom:0in;} ul {margin-bottom:0in;} --> </style> </head> <body lang=EN-US link=blue vlink=blue> <div class=Section1> <p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:navy'>That will only work with a pure AS file, not a class. It is a true “include”, and is functionally the same as putting the script directly in the main file.<o:p></o:p></span></font></p> <p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p> <p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:navy'>The class approach, while it makes references a little harder, is better since it helps to avoid the 32k limit.<o:p></o:p></span></font></p> <p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p> <p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:navy'>It is possible to have static class, instead of instantiating it, but I am not quite sure how to do that.<o:p></o:p></span></font></p> <p class=MsoNormal><st1:City w:st="on"><st1:place w:st="on"><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial; color:navy'>Tracy</span></font></st1:place></st1:City><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial; color:navy'><o:p></o:p></span></font></p> <p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p> <div> <div class=MsoNormal align=center style='text-align:center'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'> <hr size=2 width="100%" align=center tabindex=-1> </span></font></div> <p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt; font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> Omar Ramos [mailto:[EMAIL PROTECTED] <br> <b><span style='font-weight:bold'>Sent:</span></b> Thursday, February 24,2005 4:56 PM<br> <b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">[email protected]</st1:PersonName><br> <b><span style='font-weight:bold'>Subject:</span></b> RE: [flexcoders] Learning to connect actionscript pages to mxml pages</span></font><o:p></o:p></p> </div> <p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size: 12.0pt'><o:p> </o:p></span></font></p> <p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:blue'>Hi matt,</span></font><o:p></o:p></p> <p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size: 12.0pt'> <o:p></o:p></span></font></p> <p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:blue'>try this</span></font><o:p></o:p></p> <p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size: 12.0pt'> <o:p></o:p></span></font></p> <p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:blue'> <mx:Script source="brandnewas.as"/></span></font><o:p></o:p></p> <div> <p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size: 12.0pt'> <o:p></o:p></span></font></p> </div> <div> <p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size: 12.0pt'> <o:p></o:p></span></font></p> </div> <p class=MsoNormal><em><i><font size=4 color="#0000a0" face="Book Antiqua"><span style='font-size:13.5pt;font-family:"Book Antiqua";color:#0000A0'>Omar Ramos</span></font></i></em><o:p></o:p></p> <p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>Technology Manager</span></font><o:p></o:p></p> <p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:blue'>www.itacon.net</span></font><o:p></o:p></p> <p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size: 12.0pt'><a href="http://www.itacon.net/"><span style='text-decoration:none'><img border=0 width=120 height=27 id="_x0000_i1025" src="cid:[EMAIL PROTECTED]" heigth=25></span></a><o:p></o:p></span></font></p> <div> <p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size: 12.0pt'> <o:p></o:p></span></font></p> </div> <p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size: 12.0pt'><o:p> </o:p></span></font></p> <div class=MsoNormal align=center style='text-align:center'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'> <hr size=2 width="100%" align=center tabIndex=-1> </span></font></div> <p class=MsoNormal style='margin-bottom:12.0pt'><b><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Matt Horn [mailto:[EMAIL PROTECTED] <br> <b><span style='font-weight:bold'>Sent:</span></b> Thursday, February 24,2005 12:07 PM<br> <b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">[email protected]</st1:PersonName><br> <b><span style='font-weight:bold'>Subject:</span></b> RE: [flexcoders] Learning to connect actionscript pages to mxml pages</span></font><o:p></o:p></p> <p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:blue'>Try putting quotes around the {this} in the brandnewas tag:</span></font><o:p></o:p></p> <p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size: 12.0pt'> <o:p></o:p></span></font></p> <p class=MsoNormal><font size=3 color=black face="Courier New"><span style='font-size:12.0pt;font-family:"Courier New";color:black'><brandnewas id="bna" bnaview="{this}" /></span></font><o:p></o:p></p> <div> <p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size: 10.0pt;font-family:Arial;color:blue'>matt h</span></font><o:p></o:p></p> </div> <div> <p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size: 12.0pt'><br> <o:p></o:p></span></font></p> </div> <blockquote style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt; margin-left:3.75pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt'> <div class=MsoNormal align=center style='text-align:center'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'> <hr size=2 width="100%" align=center tabIndex=-1> </span></font></div> <p class=MsoNormal style='margin-bottom:12.0pt'><b><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] <br> <b><span style='font-weight:bold'>Sent:</span></b> Thursday, February 24,2005 10:46 AM<br> <b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">[email protected]</st1:PersonName><br> <b><span style='font-weight:bold'>Subject:</span></b> [flexcoders] Learning to connect actionscript pages to mxml pages</span></font><o:p></o:p></p> <p class=MsoNormal style='margin-bottom:12.0pt'><tt><font size=2 face="Courier New"><span style='font-size:10.0pt'>I am trying to teach myself how to make an mxml page and connect it to an action script page. To do this I am trying out the simplest program possible. I will show you all the code I have written for both files and what I did was just make a simple mxml page with no extra code and linked it to an action script page with what I believed to be the correct syntax. </span></font></tt><font size=2 face="CourierNew"><span style='font-size:10.0pt;font-family:"Courier New"'><br> <tt><font face="Courier New">Here is the mxml file:</font></tt><br> <tt><font face="Courier New"><?xml version="1.0"?></font></tt><br> <tt><font face="Courier New"><mx:Application xmlns:mx="<a href="http://www.macromedia.com/2003/mxml">http://www.macromedia.com/2003/mxml</a>" width="1738" height="1412" xmlns="*" ></font></tt><br> <br> <tt><font face="Courier New"><brandnewas id="bna" bnaview={this} /></font></tt><br> <br> <tt><font face="Courier New"></mx:Application></font></tt><br> <br> <tt><font face="Courier New">Here is the .as file I am trying to link it to</font></tt><br> <tt><font face="Courier New">// ActionScript Document</font></tt><br> <tt><font face="Courier New">class brandnewas</font></tt><br> <tt><font face="Courier New">{</font></tt><br> <tt><font face="Courier New"> public var bnaview:Object;</font></tt><br> <tt><font face="Courier New"> public function brandnewas()</font></tt><br> <tt><font face="Courier New"> {}</font></tt><br> <tt><font face="Courier New">}</font></tt><br> <br> <br> <br> <br> <br> <br> <tt><font face="Courier New">The error message I have been getting is that an mxml tag must be embedded within an application tag to either run or debug it. I also get an error message at the bottom for the mxml file that says in the description "Expected an attribute value[xml]" I am confused for a few reasons one being I thought I had an application tage around the brandnewas tag, and two I am not sure what var needs the attribute value?</font></tt><br> <br> <br> </span></font><o:p></o:p></p> </blockquote> <p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size: 12.0pt'><br> <br> <o:p></o:p></span></font></p> </body> </html> ------_=_NextPart_002_01C51AC1.89843CDA--
<<image/jpeg>>

