External Class Script

FLASH

    Next

  • 1. TGotoLabel not working in netscape and firefox
    I got this function which get the layer name from flash (ZoomPic.swf). I want it to display that particular frame in the layer called ZoomLayer. How do I code the below to make it work in Netscape and Firefox. It works perfectly fine in IE. function showSWFZoom(currSWF) { document.getElementById('ZoomPic').TGotoLabel("_level0", currSWF); document.getElementById('ZoomLayer').style.visibility = "visible"; } Someone please help me on this... :(
  • 2. Setting Level Number for a Movie Clip
    I'm using a the duplicate movie clip action and the new clip is being placed over top of a movie clip which is on the stage that I need to see - even though the "new" movie clip is specified to be created on level 0 of the movie. Can I use action script to change the level of a movieClip which is already on the stage so it appears "on top" of the dynaimically created one? Any help would be appreciated. Thanks in advance.
  • 3. Reading indicies/keys of assotiative arrays in AS
    Hello, I am getting a one dimensional assotiative array from a database function and would like the keys- / indicies-names of this array. Php for example provides the function array_keys() for this case. Is this possible in action script?
  • 4. CheckBox value submission to php
    I am using a simple mail form with some text fields and two checkBox elements. The form is submitting to a .PHP page. Form is submitting thru simple getURL action pointing to the php page. All the fields are working fine and sending the data in the desired manner except checkBoxes. I am unable to understand how to track if the same are 'checked' or 'unchecked' and send their value to the .php page. I have modified the php to track them, but am unable to send their values out of Flash. friends, plz let me know the solution. Rgds, Paras
  • 5. Go back to the frame you left from
    I would love to accomplish this trick if i could figure out how. This is a simple single-scene project with a number of frames. Mostly the user navigates back and forth among the frames using "next" and "back" buttons - this is no problem. What I would like to do is have a button (script) on ANY frame that takes to user to a specific frame, for example, the last frame which might be an EXIT page. Then, on that page, another button (script) that will take to user back to whatever frame they were at last, anywhere on the timeline. My gut feeling is to capture the current frame in a variable, then use that variable with a goto command to return, but I cannot get the scripting right :(

External Class Script

Postby ManinBlaq » Wed, 13 Apr 2005 00:16:36 GMT

I'm trying to include the 2.0 version of the Wddx files. (Wddx.as and 
WddxRecordset.as)   I have them downloaded, and I'm trying to include them in 
my project.  The files are local to my project.

 When I attempt to run the movie I get the following error: "Classes may only 
be defined in external ActionScript 2.0 class scripts."

 I can't find any informatin on defining / using externally defined classes.

 What am I missing?


Re: External Class Script

Postby ManinBlaq » Wed, 13 Apr 2005 00:33:14 GMT

Apparently I should be using 'import' .. not '#include' ..  

I got it working now.   Thanks!

Similar Threads:

1.Classes may only be defined in external ActionScript 2.0 class scripts

Ok I'm getting this when I try and publish my FLVPlayer:

 **Error** C:\Documents and Settings\mdugan\My 
Documents\FLVPlayer\FLVPlayerTester.as: Line 14: Classes may only be defined in 
external ActionScript 2.0 class scripts.
      class FLVPlayer extends MovieClip

 Total ActionScript Errors: 1 	 Reported Errors: 1

 The problem is, my class IS defined in an external ActionScript 2.0 class 
script. So I don't know why this error is coming up, check the code. Anyone 
help would be greatly appreciated.



 import UIManager;
 import PluginManager;
 import plugins.Plugin;
 import NSManager;
 import XMLManager;
 import mx.events.EventDispatcher;

 class FLVPlayer extends MovieClip
 {
 	//EventDispatcher needs these
 	var addEventListener:Function;
 	var removeEventListener:Function;
 	var dispatchEvent:Function;
 	var dispatchQueue:Function;

 	//Vars
 	private var m_args:Object;
 	private var m_state:Number;
 	private var m_pluginsReady:Boolean;
 	private var m_skinLoaded:Boolean;

 	private var m_hasSeekBar:Boolean;
 	private var m_nc:NetConnection;
 	private var m_nsManager:NSManager;
 	private var m_activelySeeking:Boolean;
 	private var m_hideUIInterval;
 	private var m_showingUI:Boolean;
 	private var m_enterFrameCounter:Number;
 	private var m_w, m_h:Number;
 	private var m_videoW, m_videoH:Number;
 	private var m_xmlManager:XMLManager;
 	private var m_closeInterval;

 	private var m_pluginManager:PluginManager;

 	//Attached
 	private var m_uiManager:UIManager;		//1
 	private var m_rollHandler:MovieClip;	//0

 	//Constants
 	private var k_STOPPED = 0;
 	private var k_PLAYING = 1;
 	private var k_PAUSED = 2;

 	function FLVPlayer(Void)
 	{
 		EventDispatcher.initialize(this);
 		m_state = k_STOPPED;
 		attachMovie("RollHandler", "m_rollHandler", 0);
 		m_rollHandler._alpha = 0;
 		m_activelySeeking = false;
 		m_showingUI = true;
 		m_pluginsReady = false;
 		m_skinLoaded = false;
 		m_pluginManager = new PluginManager(this);
 	}

 	// called when all plugins are loaded and 'ready'
 	public function pluginsReady(evt:Object):Void {
 		m_pluginsReady = true;
 		setUpStream();
 	}

 	function setUp(p_args:Object):Void
 	{
 		m_args = p_args;

 		dispatchEvent({type:"setUp", target:this, args:m_args});

 		if (m_args.configFile != undefined) {
 			//Load default values from XML file
 			//myTrace("need to load default values from: "+m_args.configFile);
 			m_xmlManager = new XMLManager();
 			var xmlListener = new Object();
 			xmlListener.mc = this;
 			xmlListener.load = function(p_event:Object):Void
 			{
 				//this.mc.myTrace("loaded!");
 				var children = p_event.xml.firstChild.childNodes;
 				var args = new Object();
 				for (var i=0; i<children.length; i++)
 					args[children[i].nodeName] = children[i].firstChild.nodeValue;
 				this.mc.mergeArgs(args);
 			}
 			xmlListener.error = function(p_event:Object):Void
 			{
 				this.mc.myTrace("error loading "+this.mc.m_args.configFile);
 				this.mc.mergeArgs({});
 			}
 			m_xmlManager.load(m_args.configFile);
 			m_xmlManager.addEventListener("load", xmlListener);
 			m_xmlManager.addEventListener("error", xmlListener);
 		} else
 			argsReady();
 	}

 	function mergeArgs(p_xmlArgs:Object):Void
 	{
 		for (var i in p_xmlArgs) {
 			if (m_args[i] == undefined)
 				m_args[i] = p_xmlArgs[i];	//fill in the defaults for those that are not 
defined
 		}

 		argsReady();
 	}

 	function argsReady(Void):Void
 	{

 		//Convert strings to types when needed
 		m_args.isLive = (m_args.isLive.toLowerCase() == "true");
 		m_args.autoPlay = (m_args.autoPlay.toLowerCase() == "true");
 		m_args.autoRewind = (m_args.autoRewind.toLowerCase() == "true");
 		m_args.isFullScreen = (m_args.isFullScreen.toLowerCase() == "true");

 		m_args.bufferTime = m_args.bufferTime/1;
 		m_args.bgColor = m_args.bgColor/1;

 		//Load the skin right away
 		if (m_args.skinName != undefined) {
 			attachMovie("UIManager", "m_uiManager", 1);
 			var uiListener = new Object();
 			uiListener.mc = this;
 			uiListener.play = function(p_event:Object):Void {
 				this.mc.uiPlay();
 			}
 			uiListener.pause = function(p_event:Object):Void {
 				this.mc.uiPause();
 			}
 			uiListener.stop = function(p_event:Object):Void {
 				this.mc.uiStop();
 			}
 			uiListener.seek = function(p_event:Object):Void {
 				this.mc.uiSeek(p_event.position);
 			}
 			uiListener.seekStart = function(p_event:Object):Void {
 				this.mc.uiSeekStart();
 			}
 			uiListener.rollOver= function(p_event:Object):Void {
 				this.mc.uiRollOver();
 			}
 			uiListener.onVideoSize = function(p_event:Object):Void {
 				this.mc.uiVideoSize(p_event.w, p_event.h);
 			}
 			/*uiListener.fullScreen = function(p_event:Object):Void{
 				this.mc.dispatchEvent({type: "fullscreen", goToFullScreen: 
p_event.goToFullScreen});
 				if(p_event.gotoFullScreen){
 					this.mc.getURL("javascript:videoSize('"+this.mc.m_args.divName+"', null, 
null)");
 				}else{
 					this.mc.getURL("javascript:videoSize('"+this.mc.m_args.divName+"', 
"+this.mc.m_uiManager.m_v.width+", "+this.mc.m_uiManager.m_v.height+")");
 				}
 			}*/
 			m_uiManager.addEventListener("skinLoaded", this);
 			m_uiManager.addEventListener("play", uiListener);
 			m_uiManager.addEventListener("pause", uiListener);
 			m_uiManager.addEventListener("stop", uiListener);
 			m_uiManager.addEventListener("seek", uiListener);
 			m_uiManager.addEventListener("seekStart", uiListener);
 			m_uiManager.addEventListener("rollOver", uiListener);
 			m_uiManager.addEventListener("onVideoSize", uiListener);
 			//m_uiManager.addEventListener("fullScreen", uiListener);
 			m_uiManager.loadSkin(m_args.skinName, m_args.isLive, m_args.isFullScreen);
 			m_uiManager.setBgColor(m_args.bgColor);
 		} else {
 			error("Missing parameter: skinName");
 		}

 		dispatchEvent({type:"argsReady", target:this, args:m_args});
 	}

 	//Convenience methods for PluginManager
 	//-
 	public function addPlugin(p:Plugin, pName:String):Plugin {
 		return m_pluginManager.addPlugin(p, pName);
 	}

 	public function getPlugin(pName:String):Plugin {
 		return m_pluginManager.getPlugin(pName);
 	}

 	public function removePlugin(pName:String):Void {
 		m_pluginManager.removePlugin(pName);
 	}
 	//_

 	//-
 	//UIManager Listeners
 	private function skinLoaded(p_event:Object):Void
 	{
 		myTrace("skinLoaded: "+p_event.hasSeekBar);
 		m_uiManager.setState(m_state);
 		m_hasSeekBar = p_event.hasSeekBar;

 		if (p_event.autoHide) {
 			m_rollHandler.useHandCursor = false;
 			m_rollHandler.onRollOver = doRollOver;
 			m_rollHandler.onRollOut = doRollOut;
 		}
 		m_uiManager.setSeekPosition(0);
 		m_skinLoaded = true;
 		setUpStream();
 	}

 	private function uiPlay(Void):Void
 	{
 		if (m_nc.isConnected) {
 			if (m_state == k_STOPPED) {
 				m_nsManager.play();
 			} else {
 				m_nsManager.pause(false);
 			}
 			m_state = k_PLAYING;
 			m_uiManager.setState(m_state);
 		} else {
 			dispatchEvent({type:"reconnect", target:this});
 		}
 	}

 	private function uiPause(Void):Void
 	{
 		m_nsManager.pause(true);
 		m_state = k_PAUSED;
 		m_uiManager.setState(m_state);
 	}
 	private function uiStop(Void):Void
 	{
 		m_nsManager.stop();
 		m_state = k_STOPPED;
 		m_uiManager.showBuffering(false);
 		m_uiManager.setState(m_state);
 		m_nsManager.playFirstFrame();
 	}
 	private function uiSeekStart(Void):Void
 	{
 		m_activelySeeking = true;
 	}
 	private function uiSeek(p_position:Number):Void
 	{
 		m_activelySeeking = false;
 		m_nsManager.seek(p_position, m_state);
 	}
 	private function uiRollOver(Void):Void
 	{
 		//myTrace("uiRollOver ++");
 		clearInterval(m_hideUIInterval);
 	}

 	private function uiVideoSize(p_w:Number, p_h:Number):Void{
 		m_videoW = p_w;
 		m_videoH = p_h;
 		m_uiManager.setSize(m_w, m_h, m_videoW, m_videoH);
 		m_uiManager.setSeekPosition(0);
 		m_uiManager.showSkin(true);

 		var padding = m_uiManager.getPadding();
 		dispatchEvent({type: "videoSize", w: m_videoW+padding.w, h: 
m_videoH+padding.h});
 		/*if(m_args.isFullScreen){
 			getURL("javascript:videoSize('"+m_args.divName+"', null, null)");
 		}else{
 			getURL("javascript:videoSize('"+m_args.divName+"', 
"+(m_videoW+padding.w)+", "+(m_videoH+padding.h)+")");
 		}*/
 	}
 	//+

 	//-
 	//scoped to m_rollHandler
 	function doRollOver(Void):Void
 	{
 		var o = this._parent;
 		//o.myTrace("doRollOver");
 		clearInterval(o.m_hideUIInterval);
 		if (!o.m_showingUI) {
 			o.m_showingUI = true;
 			o.m_uiManager.showUI(o.m_showingUI);
 		}
 	}
 	//scoped to m_rollHandler
 	function doRollOut(Void):Void
 	{
 		var o = this._parent;
 		//o.myTrace("doRollOut");
 		o.m_hideUIInterval = setInterval(o, "hideUI", 200);
 	}

 	private function hideUI(Void) {
 		clearInterval(m_hideUIInterval);
 		m_showingUI = false;
 		m_uiManager.showUI(m_showingUI);
 	}
 	//+

 	//+
 	//NCManager Listeners
 	function ncConnected(evt:Object):Void
 	{
 		if (evt.nc == null)
 			return;

 		m_nc = evt.nc;
 		var p_bw = evt.bw;

 		//If we need to pick a stream, do it here
 		if (m_args.streamName.indexOf(",") != -1) {
 			var sSplit = m_args.streamName.split(",");
 			for (var i=0; i<sSplit.length; i=i+2) {
 				var sName = stripFrontAndBackSpaces(sSplit[i]);
 				trace("sName:"+sName);
 				var bW = sSplit[i+1];
 				if ((p_bw < bW)||(bW == undefined)) {	//If we have less bw than the next 
threshold or if there isn't another threshold (last string)
 					m_args.streamName = sName;
 					break;
 				}
 			}
 		}

 		setUpStream();
 	}

 	function ncReconnected(evt:Object):Void
 	{
 		var ns = m_nsManager.createStream(m_nc);
 		m_uiManager.attachStream(ns);
 		m_nsManager.play();
 		m_state = k_PLAYING;
 		m_uiManager.setState(m_state);
 	}
 	//-

 	function setUpStream(Void):Void {
 		//myTrace("setUpStream..."+m_pluginsReady);
 		if (!m_pluginsReady || !m_skinLoaded)
 			return;

 		//Now the skin is loaded and the connection is established

 		//myTrace("...happening!");
 		if (m_args.streamName != undefined) {
 			m_nsManager = new NSManager(m_

2.WEBSERVICE CLASS in external Class file?

I'm currently working on a solution including .NET webservices and Flash Form 
application built in a MVC pattern with "codebehind" classes for each Flash 
FormView.
 In the concept of MVC is of course including a model which I want to call for 
a customized webservice Class which extends mx.services.WebService;
 Is this possible?
 I don't want to inlcude any script on the timeline.

3.Classes may only be defined in external ActionScript 2.0 class scripts.

i try to use the BitmapExporter 2.2.
 i inserted the .as file into the first frame in my fla but when i try to test 
movie i get
 "Classes may only be defined in external ActionScript 2.0 class scripts."
 since i am not expert in extensions - what did i do wrong and hoe can i 
properly use this extension?

4.MX 2004 Form class, Screen Class and Slide class

Anyone found any documentation for the Form class, Screen Class and Slide
class?

The help file for these classes just says:
"For the latest information about this class, click the Upgrade button at
the top of the Help tab." Click the button and no new help content is
available!!

I can't believe that Macromedia has released a product with unfinished
documentation.

Rick


5.Best Class to Learn Action Script??

I'm going to start college soon to get myself a degree in Web Design.  I've 
been using Flash for years and my greatest handicap is my limited (read: 
amateruish) knowledge of Action Script.

 I want to take a course to improve my knowledge of this language and how it 
works.  The college doesn't offer any courses specific to "Flash" itself.  What 
would any of you recommend as a standard/programming course or language for me 
to learn that would give me the best handle on Action Script?

6. Action Script 2.0, custom classes

7. Pushing Frame Scripts for Animation into Classes

8. Action Script Class text box



Return to FLASH

 

Who is online

Users browsing this forum: No registered users and 70 guest