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

Java Development

Reply
New Developer
Posts: 6
Registered: ‎03-25-2009
My Device: Not Specified

Can't use setAttribute() on SVG Animation DOM?

Hi,

 

I'm trying to create an SVG animation by setting the "value" like so:

 

e = (SVGAnimationElement) doc.getElementById("linearRot"); 

...

e.setAttribute("values", values);

 

however I am getting the SVGException "Unimplemented"... is that really so?

 

I tried setting the trait first but noticed my new values were being ignored.

 

I also tried setting "from" and "to" attributes with same error.

 

Is setting any animation tags unimplemented (unless using Plazmic)?

 

 

<animateTransform id="linearRot" attributeName="transform" attributeType="XML" type="rotate" calcMode="linear" values="0 100 100; 1000 100 100; 1700 100 100; 2340 100 100" keyTimes="0;.25;.55;1"  begin="1s" dur="10s" fill="freeze" />

BlackBerry Development Advisor
Posts: 15,752
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Can't use setAttribute() on SVG Animation DOM?

What BlackBerry Smartphone model and BlackBerry handheld software version are you testing on?  You can find this under Options, About on the BlackBerry Smartphone.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 21
Registered: ‎02-17-2009
My Device: Not Specified

Re: Can't use setAttribute() on SVG Animation DOM?

I'm getting the same issue, I have an .svg that references an image, at runtime i want to change the x value of the image to centre it using something like Display.getWidth()/2, code as follows:

 

 

protected SVGImage _image;
protected SVGAnimator _animator;
protected Field _field;

SVGScreen() {
try {
InputStream inputStream = getClass().getResourceAsStream("/mylogo.svg");
_image = (SVGImage) SVGImage.createImage(inputStream, null);

Document doc = (Document) _image.getDocument();
SVGElement element = (SVGElement) doc.getElementById("logo");
try {
element.setAttribute("x", "" + Display.getWidth() / 2);
} catch (Exception e) {
System.out.println("Error setting attribute: " + e.toString());
}

_animator = SVGAnimator.createAnimator(_image, "net.rim.device.api.ui.Field");
_field = (net.rim.device.api.ui.Field) _animator.getTargetComponent();
add(_field);

_image.focusOn(element);
_image.activate();
_animator.play();
} catch (IOException ex) {
System.out.println("Could not create SVG image:" + ex.toString());
}
}

 

Error setting attribute: org.w3c.dom.svg.SVGException: Unimplemented!

 

 Using 4.6 JDE with the Bold 9000 emulator (v4.6.0.92).

thanks.

 

 

 

Highlighted
Developer
Posts: 21
Registered: ‎02-17-2009
My Device: Not Specified

Re: Can't use setAttribute() on SVG Animation DOM?

nevermind, solved my own question, using:

 

 

element.setFloatTrait("x", Display.getWidth() / 2);