recheck export in frame 1 to test. make sure both child movieclips exist in frame 1.
One thing though, you told be to be sure that they are on frame 1.
Here is the thing, they are not. I instance my CustomScrollBar during my code in the Session.as and the errors telling me the mcBar and mcBackGround don`t exist happen in the CustomScrollBar constructor, where I change some of their values.
var scroll:CustomScrollBar = new CustomScrollBar();
and inside the constructor is
mcBar.height = 10;
Any idea ?
upping the topic so it wont be forgotten
sorry about this.
What I could do to fix this is instance a CustomScrollBar from my library into my CustomScrollBar class, but that seems a little redundant to me. I don`t think that is the best way to solve this problem...
Since the class already represents my object in the library, it should have access to its children.
Hi there, the topic was on the 4th page so I decided to make some screenshots and explain better this so it would be easier to help me out.
I don`t have a clue about it and I just crossed a point where I can`t go any further without this.
I took a photo of my publish settings, library, movieclip properties andproject folder so you can understand what is happening.
First of all, the problem is related to the topico_mc movieclip (translation: topic_mc)
topico_mc is composed by:
movieclip topico_quadrado_mc (translation: square_topic_mc) that is just a small square: mcSquare
dynamic text: dynText
I export it to actionscript with class name TopicosFlash and unchecked export in frame 1 (I tested with this checked too). I also tried browsing my symbol in the Source field just as shown in the screenshot.
I make the TopicosFlash.as file, make it extends movie clip and add a simple code to the constructor: mcSquare.alpha = 1
In the document class I simply add it: addchild(new TopicosFlash());
The issue: mcSquare is a undefined property
Trying to solve this I found some things that for me were strange:
1) If I don`t make the TopicosFlash.as file, the movieclip is added with no problems.
2) If I make the TopicosFlash.as file but let it empty flash throw an error: Cannot create property dynText on TopicosFlash.
3) If I make the file, it gives the mcSquare undefined error.
Sorry for the bad words but wtf is going on?
I really am not being able to understand this and I can`t find any answers anywhere.
Thanks in advance,
You haven't shown your class file. But in the variable declaration do you have a line such as:
public var mcSquare:Movieclip;
If you don't how is the constructor to know that this class has such a thing?
Thanks for the answer!
Well, I didn`t declare any mcSquare variable because since the whole movieclip was exported with a custom class, that custom class should have access to its children. But that is not happening in my case.
Well, I did try what you said, I declared a variable a variable mcQuadrado but it doesn`t work either.
If I don`t have a custom class, I can instance my topic_mc movieclip with no problems. I can also access its children with objectName.childrenInstanceName command. But with custom class I`m not able to.
Here is what I want to do.
In Flash IDE I want to have lots of topic_mc objects with different instance names and by code I`ll change their content and some of their behaviors.
This way I can position them all in flash IDE and change their content by coding. This makes my life much easier since I don`t have to make different buttons for different contents. I just nee to change the content by code and the rest will be automatic.
But this class problem is not alowing me to do that and I`m strangely thinking that this might not be possible? If that is right, I don`t have any ideas on how and why using custom classes.
Still needing help with this matter =(
Hi again Rothrock.
Problem solved! You were right!
But with your explanation alone I couldn`t do it. A guy in other forum told me that PUBLIC is a must. I was trying with private (I like making my classes closed, but I didn`t think it would be a problem until now).
I didn`t imagin either that I would need to add the instances as children again. By doing so I though i would be adding anothe instance of objects that are already there.. but hey... it is not what happened.
Now I`m able to continue.