Skip to main content
Inspiring
February 17, 2020
Question

Virtual Camera in Animate with Actionscript

  • February 17, 2020
  • 2 replies
  • 1420 views

Has anyone got this to work when using ActionScript 3 classes, ie not having code on the timeline.

 

It seems to me that Virtual Camera can work with Actionscript if the only actioscript is in the timeline frames Actions windows.

 

As soon as you add a Document class eg Main.as - it starts to thriw weird errors.

 

I tried to import an external class into Actionscript in the timeline (eg seeing frame 1 Actions as Main.as)

but didnt work.

 

Any suggestions help, appreciated.

 

Tommy Banana

This topic has been closed for replies.

2 replies

JoãoCésar17023019
Community Expert
Community Expert
February 17, 2020

Hi.

 

What version of Animate are you using?

 

Some previous releases indeed had some issues with the Virtual Camera, but these issues have been fixed in the most recent versions as far as I can tell.

 

And I just ran a test here using a Document Class and a Virtual Camera and everything worked as expected.

 

 

Regards,

JC

Inspiring
February 17, 2020

Using Aimate CC 2020. Are you able to put the VirtualCAmera code into an external class and get it to work without throwing type 1010 errors.

JoãoCésar17023019
Community Expert
Community Expert
February 17, 2020

Yeah, I am.

 

This is how my Document Class code looks.

package
{
	import flash.display.MovieClip;
	import fl.VirtualCamera;

	public class Main extends MovieClip
	{
		public function Main()
		{			
			var camera:VirtualCamera = VirtualCamera.getCamera(root);
			camera.setZoom(200);
		}
	}
}

 

Inspiring
February 17, 2020

OK- I take it back. Got it working.

 

I moved entire Actionscript based app;ication into a movieclip MC1 - with all code as an external MC1.as class-  - and added it to stage. I am treating frame 1 actions as Main.as and putting the cameraObj code in there and triggering camera functions  from MC1 by reference to MovieClip(root).cameraFunction(null). seems to be working - woop woop !

JoãoCésar17023019
Community Expert
Community Expert
February 17, 2020

You have been a few seconds faster than me. Haha

 

Anyway, I'm glad it worked!