Jump to content
Search Community

Error #1009: Cannot access a property or method [SOLVED]

booglebop test
Moderator Tag

Recommended Posts

this code was working fine yesterday and for some reason this morning i'm getting:

 

TypeError: Error #1009: Cannot access a property or method of a null object reference.

at gs.plugins::FilterPlugin/initFilter()

at gs.plugins::GlowFilterPlugin/onInitTween()

at gs::TweenLite/init()

at gs::TweenMax/init()

at gs::TweenMax/renderTime()

at gs.core.tween::SimpleTimeline/renderTime()

at gs::TweenLite$/updateAll()

 

i need to have this thing working today (deadline) so any help is greatly appreciated. here is the code:

 

//set up glow
var hexGlow:GlowFilter = new GlowFilter();
hexGlow.color=0xffffff;
hexGlow.alpha=1;
hexGlow.blurX=10
hexGlow.blurY=10
hexGlow.quality=3
//add fx to hex
var hexFX:Array=[hexOrangeA.hexFX,hexOrangeB.hexFX,hexOrangeC.hexFX,hexOrangeD.hexFX,hexOrangeE.hexFX,hexOrangeF.hexFX,hexOrangeG.hexFX,hexOrangeH.hexFX,hexOrangeI.hexFX];
for (var k:int = 0; k 	hexFX[k].filters=[hexGlow];
}
var glowHex:TweenMax = TweenMax.to(hexFX, 1, {glowFilter:{color:0xffffff, alpha:0, blurX:10, blurY:10, quality:3, remove:true},  yoyo:true, repeat:-1});

Link to comment
Share on other sites

re-downloaded and installed class files-no dice. i have attached the problem file. all i'm trying to do is have the hexagons glow. stop glowing on mouseover and resume on mouseout. maybe i'm approaching it in the wrong way so any feedback on my noob actionscripting is welcome...i'm pretty sure the problem lies on line 45 - var glowHex:TweenMax = TweenMax.to(hexFX, 1, {glowFilter:{color:0xffffff, alpha:0, blurX:10, blurY:10, quality:3, remove:true}, yoyo:true, repeat:-1}); but maybe i'm looking in the wrong place.

 

thanks so much for the help.

Link to comment
Share on other sites

It's because "hexFX" is an Array. You're trying to tween a GlowFilter on an Array which won't work. Only DisplayObjects can have GlowFilters applied to them.

 

I just posted an update to the platform and moved the allTo() and allFrom() methods from TimelineMax to TweenMax because several people have asked for that and the more I thought about it, the more sense it made. So if you want to tween all the DisplayObjects in the hexFX Array to the same values/filters/whatever, you can use that. I left the commented-out "allTo()/allFrom()" code inside TimelineMax if you still need it there (you can just uncomment it for now).

 

Hope that helps.

Link to comment
Share on other sites

hmmm.. good to know. that's weird because the dropshadowfilter is applied via an array and it works. so i just downloaded the updated class files and i'm getting this error:

 

1061: Call to a possibly undefined method allFrom through a reference with static type Class.

 

it's referring to this line:

buildHexTL.append(TimelineMax.allFrom(addHexes, 1, {autoAlpha:0, delay:1, stagger:.2, scaleX:0, scaleY:0, ease:Back.easeOut}));

found in the following block of code.

 

function buildHex():void {
var buildHexTL:TimelineMax = new TimelineMax();
var addHexes:Array=[hexOrangeA,hexGreenA,hexOrangeB,hexOrangeC,hexGreenB,hexOrangeD,hexGreenC,hexOrangeE,hexOrangeF,hexOrangeG,hexOrangeH,hexOrangeI];
buildHexTL.append(TweenMax.from(hexMama, 0.5, {delay:1, autoAlpha:0, ease:Linear.easeOut}));
buildHexTL.append(TimelineMax.allFrom(addHexes, 1, {autoAlpha:0, delay:1, stagger:.2, scaleX:0, scaleY:0, ease:Back.easeOut}));

}

 

any ideas? and thanks again!

Link to comment
Share on other sites

Yep, that's why I mentioned in my previous post that I moved allTo() and allFrom() to TweenMax (from TimelineMax). Your code is still calling it from TimelineMax. :) (I posted a note on the blog page too).

 

As for the dropShadowFilter stuff being applied via a regular TweenMax to an Array, I'm pretty sure that can't be the case. You sure? Could you post an example?

Link to comment
Share on other sites

if i call it using TweenMax.allFrom() i get this error :(

 

1067: Implicit coercion of a value of type Array to an unrelated type gs.core.tween:Tweenable.

 

same block of code as above with the exception that TimelineMax.allFrom changed to TweenMax.allFrom (last line in block of code below)

function buildHex():void {
var buildHexTL:TimelineMax = new TimelineMax();
var addHexes:Array=[hexOrangeA,hexGreenA,hexOrangeB,hexOrangeC,hexGreenB,hexOrangeD,hexGreenC,hexOrangeE,hexOrangeF,hexOrangeG,hexOrangeH,hexOrangeI];
buildHexTL.append(TweenMax.from(hexMama, 0.5, {delay:1, autoAlpha:0, ease:Linear.easeOut}));
buildHexTL.append(TweenMax.allFrom(addHexes, 1, {autoAlpha:0, delay:1, stagger:0.2, scaleX:0, scaleY:0, ease:Back.easeOut}));

}

 

ahhh... as far as the dropshadowfilter being applied via an array...i think you're right. the INITIAL filter values are applied/assigned via the array however when i actually tween those values i use a simple TweenMax statement.

 

//apply initial values via array
var hexShadow:DropShadowFilter = new DropShadowFilter();
hexShadow.distance=0;
hexShadow.angle=0;
hexShadow.color=0x000000;
hexShadow.alpha=0;
hexShadow.blurX=0;
hexShadow.blurY=0;
hexShadow.strength=0;

var hexFX:Array=[hexOrangeA.hexFX,hexOrangeB.hexFX,hexOrangeC.hexFX,hexOrangeD.hexFX,hexOrangeE.hexFX,hexOrangeF.hexFX,hexOrangeG.hexFX,hexOrangeH.hexFX,hexOrangeI.hexFX];
for (var k:int = 0; k 	hexFX[k].filters=[hexShadow];
}

 

//tween the shadow
TweenMax.to(event.target.hexFX, 0.3, {dropShadowFilter:{color:0x000000, alpha:0.4, blurX:50, blurY:50, strength:1, angle:45, distance:40}});

 

although i'm still using the "hexFX" var (which contains the initial array) in the TweenMax.to statement. maybe it's because i use event.target... i dunno?

 

if i do it this way it seems to work...but then i've lost the align and staggar functionality of timelineMax which i need in this case :(

 

TweenMax.from(hexMama, 0.5, {delay:1, autoAlpha:0, ease:Linear.easeOut});
TweenMax.allFrom([hexOrangeA,hexGreenA,hexOrangeB,hexOrangeC,hexGreenB,hexOrangeD,hexGreenC,hexOrangeE,hexOrangeF,hexOrangeG,hexOrangeH,hexOrangeI], 1, {delay:1.5, autoAlpha:0, delay:1, stagger:0.2, scaleX:0, scaleY:0, ease:Back.easeOut});

Link to comment
Share on other sites

TweenMax.allTo() and TweenMax.allFrom() return an Array of tweens. In order to insert that into a timeline, you need to use the insertMultiple() method (because insert(), append() and prepend() don't accept Arrays). If you want to add it to the end, just use the duration as the insertion point, like:

 

buildHexTL.insertMultiple(TweenMax.from(hexMama, 0.5, {delay:1, autoAlpha:0, ease:Linear.easeOut}), buildHexTL.duration);

 

Hope that clears things up.

Link to comment
Share on other sites

makes sense, thanks. no errors, however now i've lost the stagger of the tweens. ?

 

	var buildHexTL:TimelineMax = new TimelineMax();
buildHexTL.insert(TweenMax.from(hexMama, 0.5, {delay:1, autoAlpha:0, ease:Linear.easeOut}));
buildHexTL.insertMultiple(TweenMax.allFrom([hexOrangeA,hexGreenA,hexOrangeB,hexOrangeC,hexGreenB,hexOrangeD,hexGreenC,hexOrangeE,hexOrangeF,hexOrangeG,hexOrangeH,hexOrangeI], 1, {autoAlpha:0, delay:1, stagger:0.2, scaleX:0, scaleY:0, ease:Back.easeOut}), buildHexTL.duration);

Link to comment
Share on other sites

Yep, that's because in order to clarify the API better, I moved "stagger" to official parameter status :)

 

OLD: TweenMax.allTo([mc1, mc2, mc3], 1, {x:100, stagger:0.2, onCompleteAll:myFunction, onCompleteAllParams:[2, "myString"]});

 

NEW: TweenMax.allTo([mc1, mc2, mc3], 1, {x:100}, 0.2, myFunction, [2, "myString"]);

 

This has the added benefit of strict data typing, more helpful code hinting in certain authoring tools, and reduced code. Sorry about any confusion.

Link to comment
Share on other sites

ahhh ok cool. would you mind giving me an example? i'm not sure what i would substitute for myFunction and "myString" and where does the stagger come in... is that the function or the string? sorry i'm a designer trying to code, not a coder trying to design :)

 

thanks again for all the help!

Link to comment
Share on other sites

Oh, if you don't need to call a function when it's all done, you can just omit those last two parameters. The stagger is the 4th parameter. Your allFrom call would look more like:

TweenMax.allFrom([hexOrangeA,hexGreenA,hexOrangeB,hexOrangeC,hexGreenB,hexOrangeD,hexGreenC,hexOrangeE,hexOrangeF,hexOrangeG,hexOrangeH,hexOrangeI], 1, {autoAlpha:0, delay:1, scaleX:0, scaleY:0, ease:Back.easeOut}, 0.2)

Link to comment
Share on other sites

  • 7 months later...

Hi there,

 

First off, Fantastic Class! I used to just code my own tween manager in every fla file, but now, this had made my life SOO much easier.

Issue with the upgrade though.. i get this Error #1009 with the standard code I saw in the initial post:

 

at com.greensock::TweenLite/init()
at com.greensock::TweenMax/init()
at com.greensock::TweenMax/renderTime()
at com.greensock.core::SimpleTimeline/renderTime()
at com.greensock::TweenLite$/updateAll()

 

So if you could help, I'd VERY much appreciate it. here is the only function i'm having a problem with (all other tweens in the site work great, i suspect it may have to do with using so many variables, but we'll see huh?):

 

//toggle pages visible
function showModules(news:uint, schedule:uint, bio:uint, media:uint, ast:uint, cv:uint, rv:uint, mail:uint)
{

if (news == 1)
{
	trace("Bringing in "+latestMod+" @ X coor "+latestMod.x+" with Width of "+latestMod.width+" with Speed of "+modSpOut+" to Alpha "+news);
	//latestMod.x = stage.stageWidth + (latestMod.width + 101);
	TweenMax.to(latestMod, modSpOut, {autoAlpha:news, x:stage.stageWidth - (latestMod.width-88), blurFilter:{blurX:0, blurY:0}, glowFilter:{alpha:.95, blurX:4, blurY:4, color:0x333333, strength:3}, delay:0.5, ease:Regular.easeOut});
}
else if (news == 0)
{
	TweenMax.to(latestMod, modSpIn, {autoAlpha:news, x:stage.stageWidth + latestMod.width, blurFilter:{blurX:21, blurY:3}, glowFilter:{alpha:0, blurX:7, blurY:7, color:0x333333, strength:3}, ease:Regular.easeOut});
}
if (schedule == 1)
{
	//latestMod.x = stage.stageWidth + (latestMod.width + 101);
	TweenMax.to(scheduleMod, modSpIn, {autoAlpha:schedule, x:stage.stageWidth - (scheduleMod.width-88), blurFilter:{blurX:0, blurY:0}, glowFilter:{alpha:.95, blurX:4, blurY:4, color:0x333333, strength:3}, delay:0.5, ease:Regular.easeOut});
}
else if (schedule == 0)
{
	TweenMax.to(scheduleMod, modSpOut, {autoAlpha:schedule, x:stage.stageWidth + scheduleMod.width, blurFilter:{blurX:21, blurY:3}, glowFilter:{alpha:0, blurX:7, blurY:7, color:0x333333, strength:3}, ease:Regular.easeOut});
}
if (bio == 1)
{
	//latestMod.x = stage.stageWidth + (latestMod.width + 101);
	TweenMax.to(bioMod, modSpIn, {autoAlpha:bio, x:stage.stageWidth - (bioMod.width-88), blurFilter:{blurX:0, blurY:0}, glowFilter:{alpha:.95, blurX:4, blurY:4, color:0x333333, strength:3}, delay:0.5, ease:Regular.easeOut});
}
else if (bio == 0)
{
	TweenMax.to(bioMod, modSpOut, {autoAlpha:bio, x:stage.stageWidth + bioMod.width, blurFilter:{blurX:21, blurY:3}, glowFilter:{alpha:0, blurX:7, blurY:7, color:0x333333, strength:3}, ease:Regular.easeOut});
}
if (ast == 1)
{
	//latestMod.x = stage.stageWidth + (latestMod.width + 101);
	TweenMax.to(astMod, modSpIn, {autoAlpha:ast, x:stage.stageWidth - (astMod.width-88), blurFilter:{blurX:0, blurY:0}, glowFilter:{alpha:.95, blurX:4, blurY:4, color:0x333333, strength:3}, delay:0.5, ease:Regular.easeOut});
}
else if (ast == 0)
{
	TweenMax.to(astMod, modSpOut, {autoAlpha:ast, x:stage.stageWidth + astMod.width, blurFilter:{blurX:21, blurY:3}, glowFilter:{alpha:0, blurX:7, blurY:7, color:0x333333, strength:3}, ease:Regular.easeOut});
}
if (cv == 1)
{
	//latestMod.x = stage.stageWidth + (latestMod.width + 101);
	TweenMax.to(cvMod, modSpIn, {autoAlpha:cv, x:stage.stageWidth - (cvMod.width-88), blurFilter:{blurX:0, blurY:0}, glowFilter:{alpha:.95, blurX:4, blurY:4, color:0x333333, strength:3}, delay:0.5, ease:Regular.easeOut});
}
else if (cv == 0)
{
	TweenMax.to(cvMod, modSpOut, {autoAlpha:cv, x:stage.stageWidth + cvMod.width, blurFilter:{blurX:21, blurY:3}, glowFilter:{alpha:0, blurX:7, blurY:7, color:0x333333, strength:3}, ease:Regular.easeOut});
}
if (rv == 1)
{
	//latestMod.x = stage.stageWidth + (latestMod.width + 101);
	TweenMax.to(rvMod, modSpIn, {autoAlpha:rv, x:stage.stageWidth - (rvMod.width-88), blurFilter:{blurX:0, blurY:0}, glowFilter:{alpha:.95, blurX:4, blurY:4, color:0x333333, strength:3}, delay:0.5, ease:Regular.easeOut});
}
else if (rv == 0)
{
	TweenMax.to(rvMod, modSpOut, {autoAlpha:rv, x:stage.stageWidth + rvMod.width, blurFilter:{blurX:21, blurY:3}, glowFilter:{alpha:0, blurX:7, blurY:7, color:0x333333, strength:3}, ease:Regular.easeOut});
}
if (mail == 1)
{
	//latestMod.x = stage.stageWidth + (latestMod.width + 101);
	TweenMax.to(mailMod, modSpIn, {autoAlpha:mail, x:stage.stageWidth - (mailMod.width-88), blurFilter:{blurX:0, blurY:0}, glowFilter:{alpha:.95, blurX:4, blurY:4, color:0x333333, strength:3}, delay:0.5, ease:Regular.easeOut});
}
else if (mail == 0)
{
	TweenMax.to(mailMod, modSpOut, {autoAlpha:mail, x:stage.stageWidth + mailMod.width, blurFilter:{blurX:21, blurY:3}, glowFilter:{alpha:0, blurX:7, blurY:7, color:0x333333, strength:3}, ease:Regular.easeOut});
}
if (media == 1)
{
	trace("MEDIA Section Up!");
}
else if (media == 0)
{
	TweenMax.to(filmStrip, 0.5, {autoAlpha:media, ease:Regular.easeOut});
	TweenMax.to(slidesMc, 2, {autoAlpha:0, y:stage.stageHeight+101, blurFilter:{blurX:0, blurY:12}, ease:Regular.easeOut});
	TweenMax.to(mb, 1, {autoAlpha:media, ease:Regular.easeOut});
	titleTxt.text = "";
	vYN = false;
}
}

 

I apologize for this being lengthy, but I wanted to give you the whole scenario. As you can see, I also tried trace statements to test, but they all come back with values.. I'm so clueless right now, heh.

Thanks SO much, in advance, for any help received!

Link to comment
Share on other sites

i get this Error #1009 with the standard code I saw in the initial post:

 

It sure sounds like one of your targets must be null. Have you triple-checked to make sure you're passing in legitimate targets? I'd recommend putting a trace() above any suspect tween and see if the target is null.

Link to comment
Share on other sites

i get this Error #1009 with the standard code I saw in the initial post:

 

It sure sounds like one of your targets must be null. Have you triple-checked to make sure you're passing in legitimate targets? I'd recommend putting a trace() above any suspect tween and see if the target is null.

 

 

hi again and thanks for the quick response,

 

OK, i'll put a trace on all my tweens; thing is, it was working fine before i upgraded from v10 to v11, i just thought there might be something obvious. thanks and i'll be back.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...