• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

ActionScript 3 Error: 1046: Type was not found or....

Community Beginner ,
Oct 07, 2013 Oct 07, 2013

Copy link to clipboard

Copied

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;

}

TOPICS
ActionScript

Views

6.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 07, 2013 Oct 07, 2013

that should be:

import fl.events.SliderEvent

(and you need a slider component in your library or you'll trigger and 1172 error:

1172: Definition fl.events:SliderEvent could not be found.

Votes

Translate

Translate
Community Expert ,
Oct 07, 2013 Oct 07, 2013

Copy link to clipboard

Copied

that should be:

import fl.events.SliderEvent

(and you need a slider component in your library or you'll trigger and 1172 error:

1172: Definition fl.events:SliderEvent could not be found.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 07, 2013 Oct 07, 2013

Copy link to clipboard

Copied

Awesome. That was it. All the difference a space makes. Really appreciate your help!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Oct 08, 2013 Oct 08, 2013

Copy link to clipboard

Copied

Note that if you start typing SliderE... where you are using SliderEvent and press Ctrl-Space, Flash or Flash Builder (whichever you are using) will automatically add the import statement where it's needed, using correct syntax.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 08, 2013 Oct 08, 2013

Copy link to clipboard

Copied

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;

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Oct 09, 2013 Oct 09, 2013

Copy link to clipboard

Copied

LATEST

The error suggests the code is in a Class, but the code you posted looks like timeline code.

Often if there is an error somewhere, you'll get the above error for Classes that are not related to the error. Start with the error at the very top of the errors list. Usually getting rid of that one will get rid of the other errors like the one you posted.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 08, 2013 Oct 08, 2013

Copy link to clipboard

Copied

you're welcome.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines