Go Back   CodingForums.com > :: Client side development > Flash & ActionScript > Adobe Flex

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-05-2012, 06:59 AM   PM User | #1
tinfanide
New Coder

 
Join Date: Apr 2011
Posts: 44
Thanks: 11
Thanked 0 Times in 0 Posts
tinfanide is an unknown quantity at this point
Inherit a class from an object?

Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600" creationComplete="init();">
	
	<mx:Script>
		<![CDATA[
			
			
			public function init():void
			{
				
				// how to inherit a known class from the Canvas "box0"?
				var obj:Canvas = new Canvas();
				
				obj.x = box0.x;
				obj.y = box0.y;
				obj.width = box0.width;
				obj.height = box0.height;
				obj.setStyle("backgroundColor",box0.getStyle("backgroundColor"));
				Classroom.addChild(obj);
				
			}
		]]>
	</mx:Script>
	<mx:HBox id="Panel" x="0" y="0" horizontalGap="100" width="100%" height="200">
		<mx:Canvas id="box0" width="200" height="100" backgroundColor="Red"/>				
	</mx:HBox>
	<mx:HBox id="Classroom" x="0" y="100" width="100%" height="90%" backgroundColor="white">
		
	</mx:HBox>
</mx:Application>
If I already know the class of box0 (Canvas), how can obj inherit it from box0?
Like obj.x,
I do not type the exact value of box0.x. Instead, I use box0.x.
How can I do the same in class?
tinfanide is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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


All times are GMT +1. The time now is 02:13 PM.


Advertisement
Log in to turn off these ads.