Event Issue? Error #1046: Type was not found or was not a compile-time constant

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Event Issue? Error #1046: Type was not found or was not a compile-time constant

consciousdev
Hi there all!

Just downloaded the Flash 9 alpha after getting an intro to AS3 and
Flex. Seems like fun stuff, but I've run into a problem. For some
reason using a Event type as the input to the onComplete function is
causing problems. Perhaps a particular EventType is required?

import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.xml.XML;
import flash.event.*;
import flash.error.*;

public function ConfigInit() {
  trace("Config()");
  loader = new URLLoader();
  loader.addEventListener(Event.COMPLETE, onComplete);
  loader.load(new URLRequest("C:\\Config\\Config.txt"));
}
               
private function onComplete(evt:Event):void {
...

Flash 9 Error:

**Error**
C:\Repository\CReqs\trunk\Flash\AS3\com\creqs\ui\core\Config.as : Line
74, Column 37 : [Compiler] Error #1046: Type was not found or was not
a compile-time constant: Event.
                private function onComplete(event:Event):void {
ReferenceError: Error #1065: Variable
Timeline0_33a3fce9152d34591bcfb486e18ebe is not defined.

I've tried a number of different things, but this error always crops
up. Does anyone have any insight?

Thanks!





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[hidden email]
    mailto:[hidden email]

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply | Threaded
Open this post in threaded view
|

Re: Event Issue? Error #1046: Type was not found or was not a compile-time constant

wayne_badu_johnson
Hi

It may be an issue with your imported classes, remove flash.event.*
* XML class;

Try the following:
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.*;
import mx.utils.ObjectUtil;

public function ConfigInit() :void{
        var loader:URLLoader = new URLLoader();
        loader.addEventListener(Event.COMPLETE, onComplete);
        loader.load(new URLRequest("C:\\Config\\Config.txt"));
}
private function onComplete(evt:Event):void {
        trace("onComplete " + ObjectUtil.toString(evt.target));
}


Cheers
Wayne

--- In [hidden email], "consciousdev" <consciousdev@...>
wrote:
>
> Hi there all!
>
> Just downloaded the Flash 9 alpha after getting an intro to AS3 and
> Flex. Seems like fun stuff, but I've run into a problem. For some
> reason using a Event type as the input to the onComplete function
is

> causing problems. Perhaps a particular EventType is required?
>
> import flash.net.URLLoader;
> import flash.net.URLRequest;
> import flash.xml.XML;
> import flash.event.*;
> import flash.error.*;
>
> public function ConfigInit() {
>   trace("Config()");
>   loader = new URLLoader();
>   loader.addEventListener(Event.COMPLETE, onComplete);
>   loader.load(new URLRequest("C:\\Config\\Config.txt"));
> }
>                
> private function onComplete(evt:Event):void {
> ...
>
> Flash 9 Error:
>
> **Error**
> C:\Repository\CReqs\trunk\Flash\AS3\com\creqs\ui\core\Config.as :
Line
> 74, Column 37 : [Compiler] Error #1046: Type was not found or was
not
> a compile-time constant: Event.
>                 private function onComplete(event:Event):void {
> ReferenceError: Error #1065: Variable
> Timeline0_33a3fce9152d34591bcfb486e18ebe is not defined.
>
> I've tried a number of different things, but this error always
crops
> up. Does anyone have any insight?
>
> Thanks!
>







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[hidden email]
    mailto:[hidden email]

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/