Skip to main content
Inspiring
October 8, 2008
Answered

passing variables or targeting aray instance

  • October 8, 2008
  • 17 replies
  • 2593 views


I can get the variable into Pages.as now but the Loader will not "reload" hen the button is clicked....

Been at this for too long and could use some help. Thanks in advance to anyone out there with a bone to throw a newbie.
This topic has been closed for replies.
Correct answer Peter Lorent
God is in the details.

17 replies

Inspiring
October 12, 2008
WOW! nevermind. I had accidentally added an "s" to the end of page in Main.as

wow I deserve a medal for that one.
BAM
Peter LorentCorrect answer
Inspiring
October 12, 2008
God is in the details.
Inspiring
October 11, 2008
so they both work. I have the one you gave implemented now.
I am wondering if I can store another string of data like you did in the MainMenu.as file. I would like to get the backGround image to transition as well.

how might go about that? ie:

designBtn_mc.data(2) = "assets/pages/designMovie.swf";

is there anything similar to this above?
Inspiring
October 12, 2008
That are several solutions, but I've used the same approach as we used to set the _data property. I've changed that 'generic' name to _page and added a property for a background, again just a string that holds an url. Code attached, mind the change in Main.as (_data property changed to _page).
Another solution is to change the _data property to a generic object and assign properties to that object by way of the API of the CategoryButton.
Inspiring
October 12, 2008
Can't see why but its throwing this error - I've checked it through a number of times with no success.

1119: Access of possibly undefined property pages through a reference with static type classes:CategoryButton.
Inspiring
October 11, 2008
so it doesn't actually remove the page from memory it only visibly disappears?
I do want to avoid that.
thanks
Inspiring
October 11, 2008
Hmm, no, come to think of it I read that the Loader can only have one child so it's not stacking the content.
Inspiring
October 10, 2008
oh about the error - I had exported the actionscript improperly on some of the library items. So, I got that squared away.

If I can get the movie to run maybe we can move on to why the buttons stop working when the browser gets resized...

I love AS3 - the excitement never ends!
Inspiring
October 10, 2008
Well, maybe post the code then that loads a swf? I'll be logging out, but someone else can pick it up.
Inspiring
October 10, 2008
OK - well I got things running smoothly and am pleased with the outcome - so thank you very much for all your help.

I have not been able to get the old page to go away before the new one comes in here is my code:



If there is a better way to do it please advise.Thanks
Inspiring
October 10, 2008
Got my button states to work and things are going in the right direction =)

BUT...I haven't been able to get the movie to load.
the function is calling and working but I don't know how to arrange these variables quite yet.
Inspiring
October 10, 2008
Well my friend I think I got this thing to work. I have to do some plugging in and the hand cursor doesn't show but I think I can do it.
Thanks for all your help and I'll let you know if and how things turn out.

thanks a ton
Inspiring
October 10, 2008
You're welcome but how did you resolve that error? Were you instantiating differently, not using the document class in the property inspector or the settings, but from the timeline?
Inspiring
October 10, 2008
yeah i downloaded them

OK thanks - did that
then:

TypeError: Error #1006: main is not a function.
at classes::Main/initialize()
at classes::Main()
Inspiring
October 10, 2008
The code I posted runs so this must be in your code?
Inspiring
October 10, 2008
trying to handle this error now...

ReferenceError: Error #1056: Cannot create property loader_mc on classes.Main.
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at classes::Main()
Inspiring
October 10, 2008
Have you downloaded the sources I posted so I can remove them?

The error: did you declare the public var loader_mc in Main.as?

loader_mc should be connected to Pages.as

Ah, my bad, the instance name should not be loader_mc but pages_mc
Inspiring
October 10, 2008
So, either rename the
public var pages_mc to public var loader_mc and keep the instance name loader_mc
Or
rename the loader_mc on the stage to pages_mc (instance name)
Inspiring
October 9, 2008
What does "super()" call to? the MovieClip class?
Inspiring
October 10, 2008
Check if you have the assets like I have them. Maybe even try it in a new fla.
Place CategoryButtons on the stage. Give them instance names. Select all the CategoryButtons, convert them to a new symbol called menu. Select the menu symbol in the library and link it to MainMenu.as.
Go back to the main timeline if you are inside the menu symbol. Insert a new symbol, name it loader. Go back to the main timeline and place the (empty) loader symbol on 0,0 and give it an instance name loader_mc. Select the loader symbol in the library and link it to Pages.as. Now set Main.as as the document class of the fla. Make sure all files are in the same directory.

I've uploaded sources
Inspiring
October 9, 2008
Well, I got everything plugged in and there are no errors but there is also no response...

I am looking, at this moment at trying to get the buttons in the menu_mc to react like buttons.