How Do I Add a Background to MultiScaleImage?
I'm pulling my hair out trying to simply add an SVG or SWF background to my deep zoom image. I naively assumed I could just set the image's width and height to the scene width and height all would be well.. but that doesn't work. In fact simply adding them seems to change the scene dimensions... e.g. if I add my image at scene width and height (which are different by the way for some reason) the entire view becomes squashed and scaled. I thought I might be exceeding some max dimension so I tried adding it at half the width and height of the scene and it still distorts the scene somehow.
I could describe this in more detail but I'm not sure it would help...
Should I just give up on SVG an background or is this possible?
thanks,
Pat
I could describe this in more detail but I'm not sure it would help...
Should I just give up on SVG an background or is this possible?
thanks,
Pat
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
The company marked this question as answered.
-
Inappropriate?Pat,
It should be possible to add a custom background to your MultiScaleImage.
Can you share a code snippet that reproduces the problem you're having?
BTW, how do you get SVG into Flash?
Cheers,
Daniel
The company says
this answers the question
-
Inappropriate?Thanks. I'll have to see if I can get a standalone example together. For now I think I'm going to resort to rendering the background into the image tiles.
You can load an SVG as a Sprite like this:
[Embed(source="Some.svg")]
[Bindable] public var earth:Class;
...
var sprite:Sprite = new earth() as Sprite;
Now, I already add an empty Sprite on top of the multiscale image in order to draw onto it and that works fine. I understand how to convert between the three coordinate spaces (my image, the scene, and local) and all is well. However when I try to add the SVG sprite as a background things get wonky. I try setting the sprite.width and sprite.height to something reasonable but it doesn't work... the whole scene gets skewed. If the sprite is much smaller than the scene it sort of appears to work, but as it approaches the size of the scene the multiscale image shrinks and the sprite appears too large and offset... I really don't know what it's doing.
I have also tried setting the sprite's scaleX and scaleY instead of width and height, but to the same effect. I also tried adding the SVG to a Canvas and then adding that to the multiscale image, but that doesn't appear at all for some reason.
I read in one of your posts that UIComponents don't work as renderers... Maybe this is stemming from that?
thanks,
Pat
I’m unsure
-
Inappropriate?Pat,
Yeah, it would be great if you create an example, zip it up and post a link here.
Have you considered working more low-level, e.g. using a MultiScaleContainer with a ImagePyramidRenderer and your background?
Yes, UIComponent children are unfortunately not supported.
–Daniel
P.S. Thanks for the SVG example. Totally forgot about that ;)
-
Inappropriate?I haven't dug that far into the container yet. Are there any docs or examples that would help me understand how to use those components?
thanks,
Pat
Loading Profile...




EMPLOYEE