Copy link to clipboard
Copied
Adobe Animate can hold the code in two locations:
1 Window - Actions
2 Properties - Publish - Class (.as text file)
When anything is added into second location (#2), code from first one (#1) stops working (can't find class etc.).
How to
a fix that and how to
b convert code (#1) into (#2) to move everything to .as file and hold entire code in one place as a whole ? (most important question)
c how to export code #1 to text file not manual mouse using copy-paste in each window
#b seems to be possible because when the swf file is opened in the Sothink SWF decompiler, entire code looks like taken from #2:
Package package_name
{
import flash.display.*;
...
dynamic public classmainTimeline extends MovieClip
{
public var ....
etc.
So Adobe Animate when converts fla into swf, perhaps also converts the code from #1 to #2.
i assumed you understood the basics of class files and were asking a question with a different level of expertise. so, ignore my message 1.
to use class files, you must explicitly import all needed classes. eg, those error message indicate you need to import the mouseevent class:
import flash.events.MouseEvent;
i'm pretty sure, after you do that, you'll find there are more classes that need to be imported.
Copy link to clipboard
Copied
When anything is added into second location (#2), code from first one (#1) stops working (can't find class etc.).
that's an incorrect generalization. some timeline code is problematic when combined with class code but, in general, timeline code and class code can coexist.
and there's no simple conversion from timeline code to class file code. eg, a stop() on frame 22 of a movieclip added to the main timeline's frame 10 requires looping (eg, enterframe) to encode in a class file.
otoh, everything other than play(), stop() and goto's is pretty easily converted from timeline code to class code.
Copy link to clipboard
Copied
Even automatic addition of this default empty container:
package {
import flash.display.MovieClip;
public class foto extends MovieClip {
public function foto() {
// constructor code
}
}
}
causes:
Scene 1, Layer 'Actions', Frame 2, Line 43, Column 40 1046: Type was not found or was not a compile-time constant: MouseEvent.
Scene 1, Layer 'Actions', Frame 2, Line 78, Column 40 1046: Type was not found or was not a compile-time constant: MouseEvent.
Scene 1, Layer 'Actions', Frame 2, Line 117, Column 40 1046: Type was not found or was not a compile-time constant: MouseEvent.
Scene 1, Layer 'Actions', Frame 2, Line 152, Column 40 1046: Type was not found or was not a compile-time constant: MouseEvent.
Scene 1, Layer 'Actions', Frame 3, Line 11, Column 40 1046: Type was not found or was not a compile-time constant: MouseEvent.
So any sample code from the internet (#2) corrupts #1 and an entire movie file.
This "package" lacks apparently something. Sothink SWF decompiles creates a lot of code in #2 from #1.
Copy link to clipboard
Copied
i assumed you understood the basics of class files and were asking a question with a different level of expertise. so, ignore my message 1.
to use class files, you must explicitly import all needed classes. eg, those error message indicate you need to import the mouseevent class:
import flash.events.MouseEvent;
i'm pretty sure, after you do that, you'll find there are more classes that need to be imported.
Copy link to clipboard
Copied
Thank you. This worked, but my Trial version ends in few hours so I rather won't do anything what I wanted (getting swf variable by HTML file javascript).
Copy link to clipboard
Copied
you're welcome.
Copy link to clipboard
Copied
Adobe Animate should automatically add
import flash.events.MouseEvent;
line and other lines to #2 needed by timeline code (#1). Because so far attempt to add code to #2 (.as file) corrupts an entire movie.
Or rather the timeline code should work inependently (without or with #2).
Copy link to clipboard
Copied
what line of code is causing the error and what's the error?
Copy link to clipboard
Copied
Errors are listed in the second post of this thread (1046: Type was not found ...) and cause too. This is very severe disadvantage of code editors in Animate. And lack of possibility to save code #1 into txt file.
Copy link to clipboard
Copied
this?
Scene 1, Layer 'Actions', Frame 2, Line 43, Column 40 1046: Type was not found or was not a compile-time constant: MouseEvent.
Scene 1, Layer 'Actions', Frame 2, Line 78, Column 40 1046: Type was not found or was not a compile-time constant: MouseEvent.
Scene 1, Layer 'Actions', Frame 2, Line 117, Column 40 1046: Type was not found or was not a compile-time constant: MouseEvent.
Scene 1, Layer 'Actions', Frame 2, Line 152, Column 40 1046: Type was not found or was not a compile-time constant: MouseEvent.
Scene 1, Layer 'Actions', Frame 3, Line 11, Column 40 1046: Type was not found or was not a compile-time constant: MouseEvent.
Copy link to clipboard
Copied
You wouldn't add the import lines to the AS file if they are not needed by the AS file. You would add the import line to the timeline code, because that's where they are needed. From the look of it, both frame 2 and 3 would need this as the first line (maybe any line, but usually import lines are at the top):
import.flash.events.MouseEvent;