Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
dpcanada
Posts: 32
Registered: ‎04-19-2012
My Device: Z10, Q10, Playbook
My Carrier: Virgin
Accepted Solution

Is there a way to flip an image horizontally?

Is their a way to flip an image horizontally? I have tried the rotateZ and pivot controls but it does not flip the image horizontally.

 

Thank you.

 

Daniel

Simplify your Life...
Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Is there a way to flip an image horizontally?

I haven't tried, but I would expect scaleX: -1 to work for that. If it's not documented as supporting only positive numbers, it should, and in that case if it doesn't, it would be a bug.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Contributor
dpcanada
Posts: 32
Registered: ‎04-19-2012
My Device: Z10, Q10, Playbook
My Carrier: Virgin

Re: Is there a way to flip an image horizontally?

Thank you so much...you are a genius...appreciate it.

 

Cheers,

Daniel

Simplify your Life...
Please use plain text.
Developer
borceg
Posts: 671
Registered: ‎03-21-2012
My Device: BlackBerry PlayBook 16GB
My Carrier: Vip

Re: Is there a way to flip an image horizontally?

[ Edited ]

Qt docs say this, so negative values are supported :smileyhappy:

 

scale : real

This property holds the scale of the item.
A scale of less than 1 means the item will be displayed smaller than normal, and a scale of greater than 1 means the item will be displayed larger than normal. A negative scale means the item will be mirrored.
By default, items are displayed at a scale of 1 (i.e. at their normal size).

 

Please use plain text.
Contributor
dpcanada
Posts: 32
Registered: ‎04-19-2012
My Device: Z10, Q10, Playbook
My Carrier: Virgin

Re: Is there a way to flip an image horizontally?

It did work and exactly what I was looking for...thank you. Amazing help.

Simplify your Life...
Please use plain text.
Contributor
dpcanada
Posts: 32
Registered: ‎04-19-2012
My Device: Z10, Q10, Playbook
My Carrier: Virgin

Re: Is there a way to flip an image horizontally?

I am trying to flip the image in a container using context menus...any way I can do this...I want to just apply the scaleX: -1 to a particular container...thought it would be easy after you gave me the first part...

Simplify your Life...
Please use plain text.
Contributor
dpcanada
Posts: 32
Registered: ‎04-19-2012
My Device: Z10, Q10, Playbook
My Carrier: Virgin

Re: Is there a way to flip an image horizontally?

My last question is answered from this link...didn't see it at first.

 

https://developer.blackberry.com/cascades/documentation/ui/navigation/menus.html

Simplify your Life...
Please use plain text.
Developer
steve8820
Posts: 78
Registered: ‎04-04-2013
My Device: BB10 Dev Alpha Simulator
My Carrier: Blackberry

Re: Is there a way to flip an image horizontally?

Hi dpCanada,

 

May I know how you manage to create the image flipping horizontally? Mine sharing the idea?

Regards,

Steve Chan
Please use plain text.
Contributor
dpcanada
Posts: 32
Registered: ‎04-19-2012
My Device: Z10, Q10, Playbook
My Carrier: Virgin

Re: Is there a way to flip an image horizontally?

I will post as soon as I get in front of my computer...it will be approximately a week...sorry.
Simplify your Life...
Please use plain text.
Contributor
dpcanada
Posts: 32
Registered: ‎04-19-2012
My Device: Z10, Q10, Playbook
My Carrier: Virgin

Re: Is there a way to flip an image horizontally?

Here is what I did to flip an image...the only problem is that when I flip it the scroll of that image also flips and so to move the image left becomes right and right becomes left...hope this helps.

 

ScrollView

{

 

id: right1

 

scrollViewProperties.minContentScale: 0.25

 

scrollViewProperties.maxContentScale: 2.5

 

scrollViewProperties.pinchToZoomEnabled: true

scrollViewProperties.overScrollEffectMode: OverScrollEffectMode.OnPinchAndScroll

 

scrollViewProperties.scrollMode: ScrollMode.Both

 

ImageView{

 

id: imgView1

 

objectName: "imgView1"

scalingMethod: ScalingMethod.AspectFill

 

}

}

animations: [

 

ScaleTransition{

 

id: scaleAnimation2

 

toX: -1.0

 

duration: 800

},

ScaleTransition{

 

id: scaleAnimation4

 

toX: 1.0

 

duration: 800

 

}

]

contextActions: [

 

ActionSet{

 

actions: [

 ActionItem{

 

title: "Files"

imageSource: "asset:///menuicons/save.png"

onTriggered: {

picker1.open()

}

},

ActionItem{

 

title: "Flip"

imageSource: "asset:///menuicons/Flip.png"

onTriggered: {

scaleAnimation2.play();

}

},

ActionItem{

 

title: "Flip Back"

imageSource: "asset:///menuicons/Flipback.png"

onTriggered: {

scaleAnimation4.play();

}

}

Simplify your Life...
Please use plain text.