Copy link to clipboard
Copied
Hi, all;
I have a Class that has a radio button question in Frame 1 and a check box question in Frame 2. This is so that we can dynamically show the right question type based on the data. To enable this, both of these question views implement IQuestionView, and I just use goToAndStop to select the right one. When the setter is triggered by the player's populating the instance, I inject the View with the Question data and remove the listeners from the previous instance.
My issue is that I am getting a warning:
Warning: The instance name 'questionView' is declared on an object of type SingleSelectQuestionClip but there is a conflicting use of the instance name 'questionView' on an object of type MultiSelectQuestionClip.
It occurs to me that I could probably fix this by simply changing the type from IQuestionView to BaseQuestionView (which they both extend), but I don't want to do that because not every IQuestionView in the project is a BaseQuestionView. I'd rather not introduce inconsistency just to avoid a compiler warning, but by the same token I don't want to force the whole team to deal with a compiler warning either.
Is there another option?
Copy link to clipboard
Copied
you should be able to cast questionView as the QuestionClip type that you want and that will make the compiler happy.
Copy link to clipboard
Copied
If my Class looks like this:
public class BasePassthroughView extends MovieClip implements IQuestionView {
protected static const NOT_SET = -999;
private var _questionView:IQuestionView;
private var _kerning:int;
private var _leading:int;
protected var _question:BaseQuestion;
public function BasePassthroughView() {
super();
stop();
initFormatting();
}
protected function initFormatting():void {
_kerning = NOT_SET;
_leading = NOT_SET;
}
public function get kerning():int {
if (_questionView!=null) return _questionView.kerning;
if (_kerning==NOT_SET) return 0;
return _kerning;
}
public function set kerning(value:int):void {
if( _kerning !== value) {
_kerning = value;
if (_questionView) {
_questionView.kerning = _kerning;
}
}
}
public function get leading():int {
if (_questionView!=null) return _questionView.kerning;
if (_leading==NOT_SET) return 0;
return _leading;
}
public function set leading(value:int):void {
if( _leading !== value) {
_leading = value;
if (_questionView) {
_questionView.leading = _leading;
}
}
}
public function get question():BaseQuestion {
return _question;
}
public function set question(value:BaseQuestion):void {
if( _question !== value) {
_question = value;
initFormatting();
if (_questionView) {
_questionView.question = _question;
}
}
}
[Bindable(event="questionViewChange")]
/**
* Any "real" question views should use the instance name
* questionView so they trigger the setter and we can
* then work with them.
*/
public function get questionView():IQuestionView {
return _questionView;
}
/**
* @private
*/
public function set questionView(value:IQuestionView):void {
if( _questionView !== value) {
_questionView = value;
dispatchEvent(new Event("questionViewChange"));
if (_questionView) {
if (_kerning != NOT_SET) {
_questionView.kerning = _kerning;
}
if (_leading != NOT_SET) {
_questionView.leading = _leading;
}
if (_question) {
_questionView.question = _question;
}
}
}
}
}
Where would this casting occur?
Copy link to clipboard
Copied
i don't see anything there that's a SingleSelectQuestionClip/MultiSelectQuestionClip instance.
what's IQuestionView extend, subclass and/or implement?
Copy link to clipboard
Copied
OK, so you didn't understand the question. Never mind.
Copy link to clipboard
Copied
So, it seems like this is outside of what people on the forum can help me to actually solve, which is ok...I use Flash pretty differently than most people. However, there is still the issue that every time I run this project in Flash Pro, the Compiler Errors dialogue jumps to the front, obscuring my view of the timeline.
Given that this doesn't seem to be a fixable problem and it is just a warning, is there a setting to prevent the compiler errors tab from jumping to the front when it only contains warnings? Alternatively, is there a way I can filter out this specific warning, as is possible with Flash Builder?
Regards;
Amy