Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-23-2008, 01:13 AM   #1
stargatesg1
Registered User
 
Join Date: Jan 2007
Posts: 61
Question trying to convert this function

Trying to convert this function so i can put it in a class

Code:
//To change views need to call this function//
public function goToViews(view:String):void 
{
	if(view == "dash")
		{
		  this.myViewStack.selectedChild=this.dashboard;

		}
}
Here is what i was trying to convert it to
Code:
   //To change views need to call this function//
public function goToViews(view:String,vstk:ViewStack,viewComponent:Comp):void 
{
	if(view == "dash")
		{
		  //this.myViewStack.selectedChild=this.dashboard;
		  vstk.selectedChild=viewComponent.toString();

		}
} // End goTOViews

But i am not sure what object type viewComponent should be that is all..
stargatesg1 is offline   Reply With Quote
Old 05-23-2008, 03:41 PM   #2
drkstr
Flexpert
 
drkstr's Avatar
 
Join Date: Sep 2006
Location: Seattle, WA: USA
Posts: 1,587
Default

ViewStack.selectedChild is a Container type, so that would probably be your best bet.

Why do you have a toString() at the end?

Best Regards,
~Aaron
drkstr is offline   Reply With Quote
Old 05-23-2008, 04:38 PM   #3
stargatesg1
Registered User
 
Join Date: Jan 2007
Posts: 61
Question basically the

Basically viewComponent:Comp i am not sure what object type to make it. This will basically be the object of the different screens you want to change in the view stack.

so in your project you can have the following components

components
----------->home.mxml
------------>about.mxml
------------>contact.mxml
stargatesg1 is offline   Reply With Quote
Old 05-23-2008, 06:04 PM   #4
drkstr
Flexpert
 
drkstr's Avatar
 
Join Date: Sep 2006
Location: Seattle, WA: USA
Posts: 1,587
Default

The children of a ViewStack should all inherit the Container class, so this is what type you should make it. If you want to get real specific you can make a subclass that extends Container (or some other Container based class) then make all your components an instance of that class. However, most likely you will be fine with just setting it as Container and not worrying about it.

You should not set it using the .toString() method since this would be assigning a String value to a property expecting a Container.


Best Regards,
~Aaron
drkstr is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Horizontal Positioning via button click... VandenTR ActionScript 2.0 1 03-04-2008 06:12 AM
Remove repetitive code Glen Charles Rowell ActionScript 3.0 1 08-29-2007 02:16 PM
2 primitive numbers not showing up as equal when returned from OOP functions arianhojat ActionScript 2.0 12 03-14-2006 07:37 PM
flash movie plays in browser too slow m1cky ActionScript 2.0 7 01-11-2005 08:11 PM
enterframe and load and objects, oh my! dice ActionScript 1.0 (and below) 13 07-18-2003 11:07 AM


All times are GMT. The time now is 05:43 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.