- ImageActor frame = ImageActor::New( image );
- frame.SetDrawMode(DrawMode::OVERLAY);
- frame.SetStyle( ImageActor::STYLE_NINE_PATCH );
-
- frame.SetNinePatchBorder( Vector4::ONE * IMAGE_BORDER_INDENT );
- mFrameLayer.Add(frame);
-
- // Apply position constraint to the frame
- Constraint constraint = Constraint::New<Vector3>( Actor::POSITION,
- Source( self, Actor::WORLD_POSITION ),
- EqualToConstraint() );
- frame.ApplyConstraint(constraint);
-
- // Apply scale constraint to the frame
- constraint = Constraint::New<Vector3>( Actor::SCALE,
- Source( self, Actor::SCALE ),
- EqualToConstraint() );
- frame.ApplyConstraint(constraint);
-
- Source(self, Actor::SCALE),
-
- // Apply size constraint to the the frame
- constraint = Constraint::New<Vector3>(Actor::SIZE,
- Source(self, Actor::SIZE),
- ImageBorderSizeConstraint());
- frame.ApplyConstraint(constraint);
+ mFrame = ImageActor::New( image );
+ mFrame.SetDrawMode(DrawMode::OVERLAY);
+ mFrame.SetStyle( ImageActor::STYLE_NINE_PATCH );
+ mFrame.SetPositionInheritanceMode(USE_PARENT_POSITION);
+ mFrame.SetInheritScale(true);
+
+ mFrame.SetNinePatchBorder( Vector4::ONE * IMAGE_BORDER_INDENT );
+ self.Add(mFrame);
+
+ Vector3 sizeOffset(IMAGE_BORDER_INDENT*2.f - 2.f, IMAGE_BORDER_INDENT*2.f - 2.f, 0.0f);
+ mFrame.SetSize(mActorSize + sizeOffset);