View Full Version : Filter Operator Not Supported
IanCremona
November 18th, 2008, 05:33 AM
When I debug my flash file I get:
"_level0.promotion1.loader_mc.im....."
"im" is an externally loaded MC (published in AS3 flash 9)
When I try and stop at frame 1 with ths code:
ActionScript Code:
(getChildByName("promotion1") as MovieClip).(getChildByName("loader_mc") as MovieClip).(getChildByName("im") as MovieClip).gotoAndStop(1);
I get the following error:
ActionScript Code:
TypeError: Error #1123: Filter operator not supported on type mcPromotion.
at BannerClass/navigate()
Adobe does not seem to document this, except for a short description on the Error Messages page
Does anyone know what might have gone wrong?
theCodeBot
November 18th, 2008, 06:54 AM
It thinks that the prmotion movieClip is of type "mcPromotion" rather than movieclip. Make it's class extend MovieClip and THEN cast the reference as a movieclip, that should do it.
IanCremona
November 18th, 2008, 10:31 AM
Hi theCodeBot,
Thanks for the reply, mcPromotion is dependant a class which is extended as a movieclip. But it is still not working
Thanks
Ian
theCodeBot
November 18th, 2008, 09:38 PM
Hi theCodeBot,
Thanks for the reply, mcPromotion is dependant a class which is extended as a movieclip. But it is still not working
Thanks
IanI read it backwards 0.o
Actually, you probably shouldn't be doing direct references in the first place, but that's not all that important. I don't see any filter operators even being applied, though, so your error is stemming from somewhere else in the code. Try throwing trace statements before and after where you think the code is blowing up. If the one after the suspected block doesn't execute, it's something before that trace, since all execution stops on uncaught errors.
Krilnon
November 18th, 2008, 10:20 PM
No no, you're just using the operators incorrectly:
(((getChildByName("promotion1") as MovieClip).getChildByName("loader_mc") as MovieClip).getChildByName("im") as MovieClip).gotoAndStop(1);
IanCremona
November 19th, 2008, 09:18 AM
I tried simplifying the code as much as possible to make it work: http://www.kirupa.com/forum/showthread.php?t=313658
It still does not work though..
senocular
November 19th, 2008, 10:44 AM
Filter is an XML operation in the format of XML[List].(<i>filter</i>) ... You're crazy use of as and parens are confusing, both the compiler, and my tired eyes.
Just use conversion function casting. It's faster and a little easier on the eyes. It might also help to separate out some of your references into variables.
var promotion1:MovieClip = MovieClip(getChildByName("promotion1"));
var loader_mc:MovieClip = MovieClip(promotion1.getChildByName("loader_mc"));
var im:MovieClip = MovieClip(loader_mc.getChildByName("im"));
im.gotoAndStop(1);
Of course I'd like to think that if you're digging deep into a structure like this, you would have written your classes in a way that made this action a little more accessible and encapsulated. If you're not using classes, and/or you haven't added these objects to the display list yourself through code (which I would think not since rarely do people go to the trouble of naming their instances), you'd probably be better off just referencing the clips by name using their automatic variables.
promotion1.loader_mc.im.gotoAndStop(1);
IanCremona
November 20th, 2008, 03:51 AM
Hi Senocular,
Thanks for your suggestions, I agree with you about the code. I've now rewritten the code completely to make it shorter. Both of your suggested methods don't seem to work
ActionScript Code:
import image.imageContainer;
var promoHolder:Array = new Array();
for (var i:int = 0; i < 4; i++) {
this['Promotion'+i] = new imageContainer("images/Promo"+i+".swf","loader.swf");
promoHolder.push(this['Promotion'+i]);
addChild(promoHolder);
promoHolder[i].name = "Promotion" +i;
var Promotion0:MovieClip = MovieClip(getChildByName("Promotion0"));
Promotion0.gotoAndStop(1);
}
ActionScript Code:
package image{
import flash.display.MovieClip;
import flash.events.ProgressEvent;
import flash.events.Event;
import flash.display.Loader;
import flash.net.URLRequest;
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.text.TextField;
[I]//import iNumber;
public class imageContainer extends MovieClip {
public var imageURL:String;
public var urlRequest:URLRequest;
public var imageLoader:Loader;
public var imageWidth:Number;
public var imageHeight:Number;
public var preLoader:Loader;
public var iLoader:Number;
var mcImage:MovieClip=new MovieClip();
public function imageContainer(url:String,path:String) {//Imagewidth:Number,Imageheight:Number,
preLoader=new Loader();
preLoader.load(new URLRequest(path));
preLoader.scaleX=2;
preLoader.scaleY=2;
//preLoader.x=Imagewidth/2-preLoader.width/2; Ian
//preLoader.y=Imageheight/2-preLoader.height/2; Ian
addChild(preLoader);
imageURL=url;
//imageWidth=Imagewidth; Ian
//imageHeight=Imageheight;Ian
loadThumb(url);
//screenWandH();
}
public function loadThumb(url:String) {
urlRequest=new URLRequest(url);
imageLoader=new Loader();
imageLoader.load(urlRequest);
imageLoader.contentLoaderInfo.addEventListener(Eve nt.COMPLETE,funcComplete);
function funcComplete(e:Event) {
removeChild(preLoader);
var iLoaderHolder:Array = new Array();
for (var i:int = 0; i < 5; i++) {
this['iText'+i] = new TextField();
this['iText'+i].text = i;
iLoaderHolder.push(this['iText'+i]);
trace(['iText'+i]);
//iTextNum=['iText'+i];
addChild(iLoaderHolder);
iLoaderHolder[i].x = i * 25;
}
[I]//trace("Successfully Loaded");
//trace(iNumber);
imageLoader.content.width=imageWidth;
imageLoader.content.height=imageHeight;
mcImage.addChild(imageLoader.content);
TransitionManager.start(mcImage,{type:Fade, direction:Transition.IN, duration:3, easing:Regular.easeIn});
addChild(mcImage);
}
}
}
}
Could it be because I am trying to load the imageContainer objects as an MC?
Thanks,
Ian
AjitpalS
November 20th, 2008, 04:00 AM
You can try eval function over here..
first get typeof the object
trace(typeof this.getChildByName("promotion1"));
trace(typeof this.getChildByName("promotion1") as MovieClip);
IanCremona
November 20th, 2008, 04:10 AM
Thanks for you suggestion AjitpalS,
The result for "as MovieClip" is null, and the one without "as MovieClip" is object
senocular
November 20th, 2008, 10:47 AM
if as MovieClip gives you null, then that object is not a movie clip.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.