Error 1046: Type was not found or was not a compile-time constant: Component Event.
Hi Everyone..
I am getting an Error 1046: Type was not found or was not a compile-time constant: Component Event.
The ComponentEvent class has been imported,and also the event handling code is there. I am not sure what else is wrong, hope somebody can advise me. Thanks. The code is below, the point where the error occurs as indicated by the compiler has been highlighted.
package
import flash.display.Sprite;
import flash.media.Camera;
import flash.media.Microphone;
import flash.media.Video;
import fl.controls.TextArea;
import fl.controls.Button;
import fl.controls.TextInput;
import flash.events.SyncEvent;
import flash.events.MouseEvent;
import flash.events.FocusEvent;
import flash.net.SharedObject;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.events.NetStatusEvent;
import flash.events.FocusEvent;
import flash.events.ComponentEvent;
public class VideoChat extends Sprite
private var button:Button;
private var text_so:SharedObject;
private var textArea:TextArea;
private var textInput:TextInput;
private var chatName:TextInput;
private var nc:NetConnection;
private var nsOut:NetStream;
private var nsIn:NetStream;
private var rtmpNow:String;
private var msg:Boolean;
private var cam:Camera;
private var mic:Microphone;
private var vid:Video;
public function VideoChat ()
//Set up UI
textArea = new TextArea();
textArea.setSize(500,280);
textArea.move(20,54);
addChild(textArea);
textInput = new TextInput();
textInput.setSize(500,24);
textInput.move(20,340);
textInput.addEventListener(ComponentEvent.ENTER,checkKey);
addChild(textInput);
button = new Button();
button.width=50;
button.label="Send";
button.move(20,370);
button.addEventListener(MouseEvent.CLICK, sendMsg);
addChild(button);
chatName = new TextInput;
chatName.setSize (100,24);
chatName.move (80,370);
chatName.text="<Enter Name>";
chatName.addEventListener (FocusEvent.FOCUS_IN, cleanName);
addChild(chatName);
//Connect
rtmpNow="rtmp:/VideoChat ";
nc=new NetConnection;
nc.connect (rtmpNow);
nc.addEventListener(NetStatusEvent.NET_STATUS,doSO);
cam = Camera.getCamera();
mic=Microphone.getMicrophone();
//Camera Settings
cam.setKeyFrameInterval(15);
cam.setMode (240, 180, 15, false);
cam.setMotionLevel(35,3000);
cam.setQuality(40000 / 8,0);
//Microphone Settings
mic.gain = 85;
mic.rate=11;
mic.setSilenceLevel (25,1000);
mic.setUseEchoSuppression (true);
//Video Setup
vid=new Video(cam.width, cam.height);
addChild (vid);
vid.x=10, vid.y=20;
//Attach local video and camera
vid.attachCamera(cam);
private function doSO(e:NetStatusEvent):void
good=e.info.code == "NetConnection.Connect.Success";
if(good)
//Set up shared object
text_so=SharedObject.getRemote("test", nc.uri, false);
text_so.connect (nc);
text_so.addEventListener(SyncEvent.SYNC, checkSO);
private function checkSO(e:SyncEvent):void
for (var chung:uint; change<e.changeList.length; chng++)
switch(e.chageList[chng].code)
case "clear":
break;
case "success":
break;
case "change":
textArea.appendText (text_so.data.msg + "\n");
break;
private function cleanName(e:FocusEvent): void
chatName.text="";
private function sendMsg(e:MouseEvent):void
noName=(chatName.text=="<Enter Name>" || chatName.text=="");
if (noName)
textArea.appendText("You must enter your name \n");
else
text_so.setProperty("msg", chatName.text +": " + textInput.text);
textArea.appendText (chatName.text +": "+textInput.text +"\n");
textInput.text="";
private function checkKey (e:ComponentEvent):void
noName=(chatName.text=="<Enter Name>" || chatName.text=="");
if (noName)
textArea.appendText("You must enter your name \n");
else
text_so.setProperty("msg", chatName.text +": " + textInput.text);
textArea.appendText (chatName.text +": "+textInput.text +"\n");
textInput.text="";
//Create NetStream instances
private function checkConnect (e:NetStatusEvent):void
msg=e.info.code == "NetConnection.Connect.Success";
if(msg)
nsOut=new NetStream(nc);
nsIn=new NetStream(nc);
//NetStream
nsOut.attachAudio(mic);
nsOut.attachCamera(cam);
nsOut.publish("camstream");
nsIn.play("camstream");
Hi Guys...
I have found out what is wrong. I was importing the wrong package the correct one should have been:
import fl.events.ComponentEvent;
instead of
import flash.events.ComponentEvent;
I hope this is helpful for anyone caught in a simillar situation as me...Thanks..
Similar Messages
-
Hi There,
We're trying to add a simple link to an existing Flash file. There looks to be at least 7 separate .as files and a separate swf that loads the main swf which all seems overly complex for what is essentially a page with six buttons on it.
However, we need to add a URL to some of the text. So we converted the text to a button, added an instance name of <ssbpurchasetickets_btn> then added the following Actionscript into the actions layer on the frame the text/button appears:
ssbpurchasetickets_btn.addEventListener(MouseEvent.CLICK, ssbButtonPurchase);
function ssbButtonPurchase(event:MouseEvent):void
navigateToURL(new URLRequest("http://www.url.com/tickets.html"));
When we publish the file we get the following error which seems to cascade into a whole bunch more errors:
Description: 1046: Type was not found or was not a compile-time constant: MouseEvent.
Source: function ssbButtonPurchase(event:MouseEvent):void
We added "ssb" onto the button and functions to ensure there were no conflicts but the same thing occurred. If we copy the button into a new file everything works so it must be conflicting with something in the main files.
Any help would be MUCH appreciated!!!!
CheersThanks for the reply Ned,
The file is set to use AS3 and I'm pretty sure the original should be set to AS3 as the .as files look like AS3 syntax to me - here's a sample:
protected function handleWwrdButtonClick(e:ButtonEvent):void {
Browser.open(globalVar.xml.wwrd.item[0].@url, globalVar.xml.wwrd.item[0].@target);
OmnitureTracker.trackFeaturedContentClick('http://www.url.com/movies/international', 'wwrd_button');
timer.stop();
timer.removeEventListener(TimerEvent.TIMER, onTimer);
I'm wondering if all the Actionscript has be placed into one of the .as files as there isn't any Actionscript in the Flash project - a part from the odd stop()
Really stuck on this one (I'm not an expert at all) so any help in deciphering the project would be much appreciated.
Cheers -
1046: Type was not found or was not a compile-time constant: Event.
I am more than a little frustrated. I'm using Flash Professional CS5.5, attempting to publish ActionScript 3.0 for FlashPlayer 10.2
My code begins with:
import flash.events.MouseEvent;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.utils.Timer;
import flash.events.TimerEvent;
Then much later I have:
teamFourCar_mc.addEventListener(Event.ENTER_FRAME, trackPosition);
function trackPosition (event:Event)
and I keep getting a compiler error:
Scene 1, Layer 'actions', Frame 1, Line 434
1046: Type was not found or was not a compile-time constant: Event.
I have imported the class "Events". I have successfully used the same construction in other scripts... in fact, virtually the same construction is included in Code Snippets as Fade In and Fade Out. Adding ":void" after (event:Event) makes no difference. I have Googled - to no avail - and spent the better part of a day reading through the on-line help files, but the solution is still eluding me.
It's probably so simple I'm going to smack myself in the forehead and mutter "Duh!" when I find a solution...
If you can do anything to hasten that event (no pun intended) I (with the possible exception of my forehead) will be very grateful.
TIA
TerrySinious:
The entire code of the main movie clip is at http://pastebin.com/JYfLUhh1
A sample of one of the four "problem" movie clips is at http://pastebin.com/gQGDyngx
There is nothing wrong with the "problem" clip. The problems are in the main movie clip:
Scene 1, Layer 'actions', Frame 1, Line 427
1046: Type was not found or was not a compile-time constant: Event.
Scene 1, Layer 'actions', Frame 1, Line 612
1046: Type was not found or was not a compile-time constant: Event.
Scene 1, Layer 'actions', Frame 1, Line 1819
1046: Type was not found or was not a compile-time constant: Event.
There are the only three occurrences of a function with (event:Event). Two are ENTER_FRAME (427 & 1819) The other is COMPLETE from Loader.info
Auto format reported a syntax error "near 'if(movingCar.currentFrame == (dieRoll * 24) + movingCarPosition)' " but I can't detect what, if anything, is wrong with it.
I'm not an experienced developer... in fact, the last programming I did before taking up Flash three months ago was with QuickBasic under DOS 6.2... therefore, please try not to roll your eyes too much when you see how inelegant the code is.
I have a working version, but it's over 7,000 lines and a memory hog. I'm trying to make it more elegant and more efficient. BTW, the three (event:Event) functions are in the working version in more or less the same places, with the same calling code.
I hope you can figure it out.
Thank you in advance -
I am getting the followiing error in my main document class:
"1046: Type was not found or was not a compile-time constant:TimerEvent."
It's showing in line 47 and 54 (in red below). Any help would be appreciated. BTW, this is my first time creating a main document class since graduating to class files!:
package
//**************** IMPORT STATMENTS *********************
import flash.display.MovieClip;
import com.greensock.TweenLite;
import flash.utils.Timer;
public class Main extends MovieClip
//***************** Variables ***************************
/*private var appStoreURL:URLRequest = new URLRequest("http://itunes.apple.com/us/artist/quackenworth/id518210161");
private var facebookURL:URLRequest = new URLRequest("http://www.facebook.com/quackenworth");
private var twitterURL:URLRequest = new URLRequest("http://www.twitter.com/quackenworth");*/
private var MainScene:Main = new Main();
private var PopUp_MoreApps:MoreApps_mc = new MoreApps_mc();
private var PopUp_About:About_mc = new About_mc();
//*****SPLASH SCREEN ***
private var mc_timerSplash:Timer;
private var splashScreen:mcSplashScreen;
//*****************CONSTRUCTOR CODE ***********************************************************************************
public function Main()
mc_timerSplash = new Timer(3000,1);
mc_timerSplash.addEventListener(TimerEvent.TIMER, StartTimer);
//When timer is finished stop the timer;
mc_timerSplash.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleted);
splashScreen = new mcSplashScreen();
addChild(splashScreen);
splashScreen.x = stage.stageWidth / 2;
splashScreen.y = stage.stageHeight / 2;
mc_timerSplash.start();
//*********** FUNCTIONS *********************************
private function timerCompleted(e:TimerEvent):void
mc_timerSplash.stop();
mc_timerSplash = null;
private function StartTimer(e:TimerEvent):void
TweenLite.to(splashScreen, 1, {alpha:0, onComplete: SplashScreen});
private function SplashScreen():void
removeChild(splashScreen);
addMainScene();
private function addMainScene():void
addChild(MainScene);
MainScene.x = 489;
MainScene.y = 350;
//TweenLite.from(MainScene.wbbIntro_mc, .5, {alpha: 0});
TweenLite.from(MainScene, 1, {alpha:0});
TweenLite.to(MainScene.girls_mc, 1, {y:395, delay:.3});
TweenLite.to(MainScene.boys_mc, .5, {y:396, delay: .6});
TweenLite.to(MainScene.Joe_mc, .5, {y:339, delay: 1});
TweenLite.to(MainScene.Paul_mc, .5, {y:322, delay:1.2});
private function removeMainScene():void
removeChild(MainScene);
TweenLite.to(MainScene.girls_mc, .1, {y:690});
TweenLite.to(MainScene.boys_mc, .1, {y:693});
TweenLite.to(MainScene.Joe_mc, .1, {y:636});
TweenLite.to(MainScene.Paul_mc, .1, {y:619});Now that the error is solved, when I test nothing happens. I just get a blank screen.
What is supposed to happen? When the program opens a splash screen should be added for 3 seconds and then fade out. Then some main screen movie clips should be added to the stage. -
Type was not found or was not a compile-time constant?
Hi guys,
I'm going nuts. I've got this movieclip that I made into a
button with ActionScript. When clicked, it
should go to a frame in my main timeline labeled "beansbus",
but whenever I try to test the movie out, Flash
gives me this error:
1046: Type was not found or was not a compile-time constant:
bus.
I've looked around on the internet and I've been told that
this error can
crop up if the instance name is the same as a library object.
That WAS the
problem, but I renamed the library object to Cutebus, so that
should have fixed it, I hope. There was another fix that involved
something called TextFields in my movieclip, but I don't have
those...
My code looks like this, which was copied and pasted from an
in-class tutorial that DOES work, with no problems.
Thanks in advance for any light you can shed on this.actually the error:
quote:
TypeError: Error #1009: Cannot access a property or method of
a null object reference. at
beans_fla::MainTimeline/frame1()[beans_fla.MainTimeline::frame1:3]
may not obviously give the line number at first
glance, but it does! 'frame 1:3' refers to frame 1, line 3. which
if your code post was accurate to line numbers, refers to:
quote:
bus.stop();
so i'd suggest looking at your bus clip and
ensuring that you have correctly defined its instance name. Also,
make sure you have this correctly defined in each keyframe that the
clip appears. -
ActionScript 3 Error: 1046: Type was not found or....
Hi,
I am completely new to Flas and AS3. I am trying to create an opacity slider using the slider component. I foudn a similar tutorial and tried to alter it to fit my opacity needs. In line 8 (function opacityChange (event:SliderEvent):void{) I get the error message 1046. When I test it in Flash the slider flickers on and off very rapidly too. Though I have searched, I am clueless as to what the problem is.
Any help will be appreciated.
Thanks!!
importfl.events.SliderEvent;
percent_txt.text = "Opacity %:0";
slider.value = 0;
slider.addEventListener(SliderEvent.CHANGE,opacityChange);
function opacityChange (event:SliderEvent):void{
percent_txt.text = "Opacity %: " + event.target.value;
logo.alpha = event.target.value;I am trying to duplicate the slider event for additional sliders and run into a 5000: The class ... must subclass 'flash.display.MovieClip'
Any advice? (I know I need to take a class)
And thanks again.
import fl.events.SliderEvent;
skinPercent_txt.text = "Opacity %:100";
skinSlider.value = 1;
skinSlider.addEventListener(SliderEvent.CHANGE,opacityChange);
function opacityChange (event:SliderEvent):void{
skinPercent_txt.text = "Opacity %: " + event.target.value*100;
skinLayer.alpha = event.target.value;
superfPercent_txt.text = "Opacity %:100";
superfSlider.value = 1;
superfSlider.addEventListener(SliderEvent.CHANGE,opacityChange);
function opacityChange (event:SliderEvent):void{
superfPercent_txt.text = "Opacity %: " + event.target.value*100;
superfLayer.alpha = event.target.value; -
1046: Type not a compile-time constant: TimerEvent.
I have a simple space ship in an fla
have this .as file
but still getting the error
related to the line "public function
moveClip(event:TimerEvent):void {"instead of using
import flash.events.TimerEvent.*;
use
import flash.events.TimerEvent;
and you probably need
import flash.utils.Timer; -
1046: not a compile-time constant: TimerEvent.
I know this is simple but I just cannot see what I am doing
wrong
it is in reference to "public function
moveClip(event:TimerEvent):void {"
any help is appreciated .
my code is attached
thank youI am old .. and I guess I just see what I want to see ...ty
for your help
I moved it to AS3 ...
I added the timer change found a few more errors and
then I got same error ... -
Initializer element is not a compile-time constant in Xcode
hi.......Every one
ModelController.h
#import <Foundation/Foundation.h>
@interface ModelController : NSObject
@property(nonatomic , strong)NSArray *states_Array;
@end
ModelController.m
#import "ModelController.h"
@implementation ModelController
@synthesize states_Array;
states_Array = [[NSArray alloc]initWithObjects:@1,@2,@3, nil];
@end
Now i want to access these array in MY TableViewController at cellForAtIndexPath
Thanks InAdvanceIf you're using Flex 3.4 SDK, put only AdobeSpellingEngine.swc and AdobeSpellingUI.swc in your libs folder. (AdobeSpellingUIEx.swc is for Flex 4)
For more details, please refer to the release notes
http://labs.adobe.com/technologies/squiggly/releasenotes.html
Hope this helps. -
"1046: Type was not found" for a custom class calling a custom class
This should be easy... but I've spent two days on nothing but this error.... I am absolutely at my wit's end.
Basically, I've got a "character" container linked to a MovieClip in the library that is supposed to act as a container for various body parts; head, shirt, pants, etc. For simplicity, I've just got Character class and Head class, both in a "char" package, both classes are named the same as their respective files (Character.as and Head.as, both in an actual file called "char"). Character class is supposed to create an instance of Head, but I always get this 1046 error. The problem is that I've got other body parts with nearly identical classes that ARENT throwing a 1046 error and are working just fine. I went and made a new project to see if I was still having the problem with just character calling 1 simple body part. I do.
In the symbol properties, it's Exported for Actionscript & Export in Frame 1... the class is "char.Head" and "char.Character" respectively. I have tried everything I can find or think of, I've done dozens of Google searches and sifted through dozens of forums. I can't find anything and I've been working on this problem for 24 straight working hours now. I'm completely exasperated......
package char {
import flash.display.MovieClip;
import flash.display.Stage;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.ColorTransform;
import fl.motion.Color;
import char.Head;
public class Character extends MovieClip {
// 1046: Type was not found or was not a compile-time constant: Head
private var _head:Head;
// reference to get the stage later
private var stageRef:Stage;
public function Character(stageRef:Stage=null) {
trace("NEW CHARACTER");
//1180 Call to a possibly undefined method Head;
_head=new Head();
And here's the contents of Head.as
package char {
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.Stage;
import flash.geom.ColorTransform;
public class Head extends MovieClip {
private var skin_type:uint;
public function Head() {
trace ("NEW HEAD");
Now if I declare the head variable and create a new instance of it in my document class, no problem whatsoever. If I do it in my Character class, it just doesn't stop giving me this error!!! Somebody please help me.
1046: Type was not found or was not a compile-time constant: Head
1180 Call to a possibly undefined method Head;There is a blank movieclip named Character in the library, yup.
Also in my main handler for my document class calls "mainCharacter = new Character(); "
Here's a chunk of the code from the document class. For the record, it calls "head" as just a test and that works fine. Just doesn't work in "Character"
import char.Character;
import char.Head;
public class MainHandler extends MovieClip {
private static var _instance:MainHandler;
public static function get instance():MainHandler { return _instance; }
public var mainCharacter:Character;
public var head_:Head;
public function MainHandler() {
_instance = this;
mainCharacter = new Character();
head_=new Head(); -
Error: Object type '' could not be generated when creating sales order
Hello Friends,
I am using a SAP standard ITS service to create sales order.
When I am creatin SO, it gives me error Object type '' could not be generated.
Can you plz suggest me what is that issue & how I can reslove it.
Regards,
Narendraany inputs around this plz??
-
Error: "Transaction type could not be determined" during PO Creation fromSC
Hi all,
I'm working on SRM 5.5 with ECS.
During the creation of a PO I want to add a SC as an item of PO.
But when I chose the SC and click on the button Add to PO I recive the error:
Transaction type could not be determined
In the organizational unit I set the attribute BSA and DP_PROCT_TY.
there are other steps I have to do to join the transaction type of SC and PO?
rgs
enzoHi Enzo,
First check if the attribute BSA and DP_PROC_TY have the same value.
Then in the attribute value for BSA, change the source system for the document type to your SRM system.
Create a new PO and a shopping cart.
Try changing the PO by adding the shopping cart
Hopefully your problem may get resolved.
Thanks
Sanjeev -
Post Goods Issue - error : Class type does not exist - Message no. VK662
Hi,
I am trying to do Post Goods Issue and getting this error: Class type does not exist
When double click on the error, it shows it is a message no vk662.
Any help to resolve it is appreciated. Thanks in advance.
-SriSri
There is a problem in batch determination.
The batch you assigned to the material does not have a class or if it has a class, that class does not exist.
Display the batch from the delivery item using MSC3N and go into the Classification tab. You should have a class of class type 22. See if that class exists in CL03 and its status in basic data tab. Work on these lines and revert.
Hope this helps. -
Error:"Transaction type is not valid in GL Account(Asset Recon)",MIRO
Hi,
We are getting an error "Transaction type is valid in GL Account XXXX" while posting invoice through MIRO. This GL account is Asset recon. account.The PO is created for asset aquisition for a quantity of 9.
Initially GR was done for 9 but IR was created for 8.
Later when we tried to post invoice for 1, we are getting this error.
Can anybody tell me the probable reason behind this error?
Thanks,
Mano.Hi Mano,
could you please give me the code of the error message.
regards Bernhard -
FBV1 error - Transaction Type 030 not possible
Hi SAP experts,
I am currently facing an issue while in FBV1 (via batch input)
It displays error message Transaction Type 030 not possible (posting to affiliated company), however, the asset group that it belongs to can only be Type 030 (Acquisition in group area only).
How can this be fixed?
Is there another TType that is similar to 030 ?
Any help is welcome
Regards
RogerHi,
check SAPNET note 127650.
Best regards
Maybe you are looking for
-
How to read the content in one node of XML in Java? Pls help
My dear brothers, I am a newbie of XML, I have a exercise which is creating a Tree View from XML file. But the trouble is I do not know how to read the content in one node of XML file. I decide to use the algorithm as following: 1. Create a GUI form
-
Dual 23" displays showing distint difference in color and brightness
Today I purchased a second 23" cinema display to run a dual display set up. I am now noticing that my first display, purchased about a year ago refurbished from apple, is distinctly darker and has a slightly yellowish tint to it in comparison to the
-
2008 R2 Remote Desktop Services Problems With Older RDP Clients
I recently deployed a new 2008 R2 server to serve as a Terminal Server (Remote Desktop Services) for about 30 people. The new server is replacing a 2003 server. I expected the new machine to be a considerable upgrade and was looking forward to happy
-
CS3 Flash Movies in Webpages Problem
I know how to make a generic flash movie player and all that in flash cs3 with their tutorials/quick import, but i cant quite seem how to find this: When you say embed a youtube video to myspace, or online they don't auto load, instead they seem to h
-
How do I save *complete* KDE4 and x config?
I've always had trouble getting a global view of DE configuration, x configuration, etc. For now, I've got KDE4.2 looking and behaving exactly as I want, which is not always the case. What do I need to back up in order to restore this if and when som