1

I have an old Flash game where I used interpolateColor to blend colours extensively and it worked.

But it's giving an error now. Here is the code:

var firstColour = firstFusionGenes.girl.body.head.shapes.transform.colorTransform.color;
var secondColour = secondFusionGenes.girl.body.head.shapes.transform.colorTransform.color;
var newColour = this.transform.colorTransform; //so it's not empty
newColour.color = Color.interpolateColor(firstColour, secondColour, 0.5);

I've traced the results of firstColour and secondColour and they come back as color integers as expected. But I get the error:

ReferenceError: Error #1065: Variable Color is not defined.

I've made sure to add all the lines about importing Color into Flash, although it used to work without that anyway. Something I did when reformatting it to app format has broken it. But I don't understand the error; it's like it doesn't understand what "Color" is now? What does the error mean?

Addendum:

I made a fresh new file testing out the code and it gives a different error:

1120: Access of undefined property Color.

But this error goes away when I include this in the file:

import fl.motion.Color;

So I don't think it's an issue of Color not being in the program. The error from that is slightly different.

ola.rogula
  • 307
  • 1
  • 9
  • 2
    The **Color** class is not an intrinsic **Flash Player** class, it is a class that is packed with **Flash CS3 IDE** (the official documentation states so: https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/motion/Color.html). That means, other Flash IDE versions just might not have this class. To solve that you need either to use **CS3** to build your app, or create your own class, or grab an existing one (you can take mine and add **interpolate** method: https://bitbucket.org/thydmitry/ru.delimiter/src/default/classes/ru/delimiter/math/RGB.as). – Organis Jul 03 '19 at 11:50
  • Thank you! What's weird though is that I can use Adobe Animate CC to export the old game version to a swf and AIR for Desktop application and it works just fine. Doesn't that mean it's still included? – ola.rogula Jul 03 '19 at 17:29
  • Yeah, I just triple checked: i took the old game, re-exported in the new Animate. Exporting to Flash Player 16, Flash Player 26, AIR for Desktop 32.0.0.116, AIR for iOS; no problems. So Color must still be in there somehow, no? – ola.rogula Jul 03 '19 at 18:04

1 Answers1

2

I kept tinkering with the new file that worked and tried to find a difference in the settings between it and my broken file. Finally I found this folder in the appended files. When I removed it from the new file, it gave the same error. So I went back and made sure to add this folder to the broken file (it was missing), and that solved the issue! I'm assuming this has something to do with allowing Animate to pull in the Color code like Organis was saying.

enter image description here

ola.rogula
  • 307
  • 1
  • 9