|
-
problems w/ TileList component
I'm starting to hate components! I do a trace on my TileList instance with "getItemAt(i)" in a loop and it tells me that every item is an instance of my movieclip I want displayed...however, I get these errors and I don't know why. Obviously, something is "null", but what?
PHP Code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at fl.containers::BaseScrollPane/fl.containers:BaseScrollPane::drawBackground()
at fl.controls::TileList/fl.controls:TileList::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/drawNow()
at fl.controls::ScrollBar/fl.controls:ScrollBar::draw()
at fl.core::UIComponent/::callLaterDispatcher()
I like using components because I don't want to reinvent the wheel, but they seem so buggy! Your thoughts...
-
follow-up:
I tried to use the Help example in the Flash doc and got the same error after following directions and cutting and pasting code? anybody have any idea?
-
c'mon, somebody give me a clue! sorry if I'm impatient!
-
surely someone has encountered this problem before?
-
so, I will answer my own question and follow it up with another question...the reason why I had the errors with the Help example and my original problem is because I did not add the TileList component to my main FLA. The Help example did say to do that.
Why is the question? Why should you have to add a component to your main FLA library? Is there any way around this?
-
trace("AKA: Biro Barna");
^ "Error #1009: Cannot access a property or method of a null object reference. " as if says: "null object", meaning that you are referring to an object that does not exist ( or does not yet exist ). In order to talk to an object you have to have the object on the screen. You first instantiate the object, add it to the display list and only after it's there can you interact with it.
Think of it like when you're trying to talk to your best friend. You know he exists but no matter what you do and try to tell him you won't be able until he is not standing in front of you ( don't think about internet chatting now, just simple communication ).

| Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro | WebLog: http://blog.wisebisoft.com/ |
| Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
| Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/ | By perseverance the snail reached the ark. |
-
yes, I realize that about the null object...but the way I fixed the error was by adding the TileList component to the library of my source FLA! after that, it worked??? why does the component need to be added to the library? Why can't I just say:
var tl:TileList = new TileList();
addChild(tl);
w/o having to add it to the library also? that's my question...I guess AS3 treats it just like an "exported for AS" library symbol...which it really is I guess.
-
trace("AKA: Biro Barna");
I don't think it's a must, at least it wasn't a requirement for all the other components. If you'd post your code maybe we could take a look and see what's wrong or what's right. Components can be added by code and as for as I'm concern you don't have to place them manually into the library just to use them.

| Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro | WebLog: http://blog.wisebisoft.com/ |
| Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
| Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/ | By perseverance the snail reached the ark. |
-
that's what I thought! all you have to do is try the TileList example in the Flash Help doc (the one where you create a star symbol)...if you don't put the TileList in the library, you get the errors I mentioned above. If it doesn't happen for you, there must be a problem with my installation or something? Let me know if you try it...
-
trace("AKA: Biro Barna");
Ok, I only have one problem with those examples. For some weird reason Flash can't find fl.controls - Maybe if cancerinform sees this post he could enlighten me with this crap, Flash is simply not finding fl.controls ; no idea why....

| Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro | WebLog: http://blog.wisebisoft.com/ |
| Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
| Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/ | By perseverance the snail reached the ark. |
-
ok, I have that answer...for some reason it doesn't find it and you have to add it to your classpath. I'm sure you already know how to do that...on my PC the path to the "fl.controls.*" package is:
C:\Program Files\Adobe\Adobe Flash CS3\en\Configuration\Component Source\ActionScript 3.0\User Interface
-
I'm having this problem as well, but only when I load the SWF containing the TileList with a Loader. I fixed it by adding the TileList component to the library of the Loader's FLA.
absolutezero's solution of adding the class path to the fl.controls folder did not work at all for me.
The guys at Adobe should really be looking at this if they want AS 3 to be a true OO scripting language, but maybe that's what FLEX is for!
-
Hey guys,
I had exactly the same problem and it was driving me mad, but I found the solution here:
http://board.flashkit.com/board/showthread.php?t=765993
Basically, when you load the external SWF with a loader, you need to provide a loader context and set the ApplicationDomain of the loaderContext to currentDomain, as follows:
var context:LoaderContext = new LoaderContext();
context.applicationDomain = ApplicationDomain.currentDomain;
loader.load(loaderUrl,context);
Hope this helps!
-
 Originally Posted by [email protected]
Hey guys,
I had exactly the same problem and it was driving me mad, but I found the solution here:
http://board.flashkit.com/board/showthread.php?t=765993
Basically, when you load the external SWF with a loader, you need to provide a loader context and set the ApplicationDomain of the loaderContext to currentDomain, as follows:
var context:LoaderContext = new LoaderContext();
context.applicationDomain = ApplicationDomain.currentDomain;
loader.load(loaderUrl,context);
Hope this helps!
Kcolgan!!!!!! Me salvaste la vida!!! con este codigo. En muchos lados busque y sab*a que la solucion tenia que ver con el ApplicationDomain, pero no encontraba un ejemplo de como hacerlo. Ahora LO LOGRE... Para que quede un poquito mas completo, les copio mi funcion que carga un SWF Externo.
var context:LoaderContext = new LoaderContext();
context.applicationDomain = ApplicationDomain.currentDomain;
var loaderSWF:Loader = new Loader(); loaderSWF.load(new URLRequest(ruta), context);
Nuevamente, MUCHAS GRACIAS!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|