Adding images to the stage
Hello,
I am currently working on a photo gallery which reads an XML file and load all picture from it. I am doing all by AS3 by adding bitmapdata to the container by loader object. What I want to do is when I add these images they behave like a button, by enabling hand cursor and pointing to a specific frame or an URL when I click on it. How should I proceed with the script to do so ? (Create a button or a movieclip which can be clicked and all this on a dynamic way)
Thank you all guys !
Hey kglad,
Thank you...that helped !
Similar Messages
-
Adding objects to the stage & acceessing stage properties - I'm a bit confused..
Hi,
I'm a little confused on two fronts regarding display
programming:
A. What the best way to add objects to the stage?
B. How to access stage properties.
I can do both of these when the project is an 'Action Script
Project', but I'm having trouble when it is a 'Flex Project' (e.g.
an MXML file). See the two attached files with questions included
in the comment to see exactly what I mean.
A. What the best way to add objects to the stage?
=====================================
In an action script project that extends Sprite I can just
call addChild()
In an MXML project I can add objects to the stage by first
adding them to a UIComponent, then adding that to the stage.
1. Is that the best way to do it?
In this doc:
http://livedocs.adobe.com/flex/3/html/help.html?content=05_Display_Programming_02.html
it says that
quote:
Each SWF file has an associated ActionScript class, known as
the main class of the SWF file. When Flash Player opens a SWF file
in an HTML page, Flash Player calls the constructor function for
that class and the instance that is created (which is always a type
of display object) is added as a child of the Stage object. The
main class of a SWF file always extends the Sprite class
2. why cant I just add a sprite object direct to the stage
without the UIComponent?
3. What is the 'main class', and how can i get access to it?
B. How to access stage properties.
=========================
In an action script project that extends Sprite I can just
call trace(stage.framerate)
But in an MXML file I cannot figure out how to access the
stage properties.
See the attached code for the things that I tried, but which
didnt work.
In the page:
http://www.actionscript.org/forums/showthread.php3?t=140655
It says
quote:
For stage access you have a couple of rules:
* natively, only display objects have inherent access to
stage
* display objects only have a valid reference to stage if
they're within the stage's display list (on the screen, after added
to it with addChild)
* The only display objects which immediately have access to
the stage before the use of addChild (in their constructor) are the
document/application class instance (root) and any instance from
the library placed on the timeline (not created with AS).
* Non-display object classes have to be passed or assigned a
reference to the stage from another object which already has access
to it - they cannot access it otherwise.
4. How do I access the stage properties in the MXML project?
5. I suspect this is related to the "main class", which I
dont yet understand - is it?
Sorry for the long post.
cheers
tom"tom saffell" <[email protected]> wrote in
message
news:gd7cm9$d1v$[email protected]..
> Thanks Luigi - that helps a lot.
> I hadnt seen the Flex 3 Developer Guide before - it's
very useful.
>
> I now see that I can access properties of the
application object directly
> with
> this.<property>.
> However, the framerate property cannot be set by
actionscript, only in
> MXML (I
> can set it in the <mx:application> tag). But I
need to be able to set it
> programatically, dependent on user input.
>
> 5. Is there a way around this?
> 6. Can I set the stage's framerate to achieve the same
outcome?
>
> I still dont understand why I cannot access the stage
object. When I call
> either
this.stage or
uic.stage * then I get
quote:
Cannot access
> a
> property or method of a null object reference.
My understanding is
> that I
> can access the stage object via any display object on
the display list.
> I'm
> confused about this bit..
>
> * - uic is a UIComponent that has been added to the
display list (i think)
> by
> calling addChild(uic) from the AS3 within the
application
>
> 7. How do I access stage properties in AS3 in an MXML
project?
http://www.adobe.com/livedocs/flex/3/html/help.html?content=05_Display_Programming_10.html
It seems like possibly your real problem is that you're
having trouble
searching the Help effectively:
http://flexdiary.blogspot.com/2008/07/getting-help-in-flex-builder.html -
Adding Images to the List component
Adding Images to the List component while using the FLV
PLayback
All, ( i can send you my source files if it would help)
I'm using the FLV Playback component and loading videos into
it from an external xml file. I also have a list component tied to
the FLV playback that when you click on one of the elements in the
list, it plays that movie.
QUESTION:
My question is how do I add an image to the list component?
Below is the xml file and the actionscript. I've added the image
attribute to the XML file as img="time_square.jpg" and added the
element of the array when calling/creating the list. Did I do this
right?
Any direction would be very much appreciated.Adding Images to the List component while using the FLV
PLayback
All, ( i can send you my source files if it would help)
I'm using the FLV Playback component and loading videos into
it from an external xml file. I also have a list component tied to
the FLV playback that when you click on one of the elements in the
list, it plays that movie.
QUESTION:
My question is how do I add an image to the list component?
Below is the xml file and the actionscript. I've added the image
attribute to the XML file as img="time_square.jpg" and added the
element of the array when calling/creating the list. Did I do this
right?
Any direction would be very much appreciated. -
Cannot view images on the stage in AS3
Hi guys, I've had Flash CS4 for a while but never been able to use Actionscript 3 as any images dragged to the stage just disappear -- but of course are there when you preview the movie. I've reset the program, tried changing all around the views and resetting preferences -- and it works fine with new AS2 documents, but this problem has got me annoyed! I can't see anyone else with this problem while surfing the web, but thought it was time to get proactive and ask for your help and ideas!
Cheers guys, any help is much appreciated.Hi guys,
First off - thanks so much for taking the time to read this and answer to help me out. It's much appreciated, and better than anything that Adobe have offered (except to host these forums I suppose). I don't want to set myself up for a big fall and say that it can't be something simple as I could well be missing something, but it's definitely not a case of just adding a new layer and importing to the stage again. I've used Flash since way back in version 5, and like I said it works fine for Actionscript 2 documents, just seems a weird issue with (my) Actionscript 3.
I've looked at other suggestions, but as you can see from these screenshots all the layers are visible and not locked. Alpha is 100%, and it doesn't just affect new library objects but al drawing objects on the stage -- they can be drawn, but then quickly disappear. They are still there, and the cursor will change when hovered over the spot where they should be. The paths can also be seen when highlighted by the subselection tool. I've tried using the bring to front etc and anything else I can see. Also, I reinstalled the Flash Pro kit, so it must be something with my default setup.
Image 1 - just about to drag a Facebook gif icon to the stage.
Image 2 (it's different, honest!) - The layer has been filled, but the library item can't be seen. Also makes no difference if the Flash file is saved first or not. The cursor changes to the "move" type graphic when hovered over the invisible graphic too.
Any of you guys have a fix I'll buy you a drink next time you're near Durham (UK)!
Jordan -
How to remove a loaded image on the stage from a symbol containing a button?
1st the setup:
General map is loaded
2. On a click event, an larger image of the region is loaded with the following code (thanks to Joel's demo). On mouseover the name of the county appears and on click a popup (symbol) shows some info.
$('<img id="region1" width="310" height="475" src="images/region1.png" usemap="#region1">'+'<map name="region1">'+...
'<area id="Dallam" shape="rect" title="Dallam" coords="29,17,97,58"/>'+.....
3. In the popup symbol, I want the large image map to be remove on the click event of the button: "View another region" . I have the following code which does not work (the image is not removed) resulting in what you see below:
sym.playReverse();
sym.getComposition().getStage().stop(0);
sym.getComposition().getStage().getElementById("region1").remove();
So my question is how do I remove the image (large image of the region in purple here loaded as described on 2.)?I got it. It should be:
$("#region1").remove();
// # was missing.
I actually added that to time 0 on the main timeline so when I got back there it removes the image.
It's not working from the symbol yet but I guess I should eventually get it working from there instead.
Thanks for your time. -
Adding image for the selected Tree leaf???
Hi All,
I am working with flex tree component in which i have to add
an arrow image for the selected leaf node. I tried to do this using itemclick event
but cant make it. can you help me out in doing this???
Note: I have written custom Tree and TreeItemRenderer...
-SundarThanks for ur reply Grizzzzzzzzz,
is there a way to identify the selected leaf from within MyTreeItemRenderer(Extends TreeItemRenderer)?
If this is possible,i can add the image to the selected leaf of the tree.
Right now i am assigning images to all the leaf nodes of the tree as follows:
public
class MyTreeItemRenderer extends TreeItemRenderer
* Override to draw a line in case current item is a leaf.
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):
void{
// Call super method
super.updateDisplayList(unscaledWidth, unscaledHeight);
if(super.data){
if(TreeListData(super.listData).hasChildren){
// logic for parent node comes here
else{
//Adding leaf Image
//Logic to add images to leaf
myImage.source = leafImage;
myImage.x =
super.label.x;
//The above code adds images to all leaf nodes. CAN I ADD THIS IMAGE ONLY TO THE SELECTED LEAF NODE???
//HOW TO FIND THE SELECTED LEAF NODE FROM HERE??? SO THAT SELECTED LEAF WILL BE ADDED WITH THE IMAGE???
//The above code adds images to all leaf nodes. CAN I ADD THIS IMAGE ONLY TO THE SELECTED LEAF NODE???
//HOW TO FIND THE SELECTED LEAF NODE FROM HERE??? SO THAT SELECTED LEAF WILL BE ADDED WITH THE IMAGE???
THANKS,
SUNDAR -
Hello All,
Kindly let me know how I can attach an image to the Content Management folder and show the image along with the folder name on the portal? Do I have to use different UI?
Any Ideas or suggestion. I wanted the way just like http://service.sap.com homepage with images.
Regards,
PraveenHi Preveen,
the "Entrypoint Exlorer" layoutset came in SP2 with Patch5. I think you can create yourself such a layout set in KM configuration.
For this do the following:
1. Create a Collection Renderer: Configuration -> Content Management -> User Interface -> Settings -> Collection Renderer Settings -> New
Use the following settings (some parameters might not exist in your SP version):
Name EntrypointsCollectionGridRenderer
Description The entrypoint categories renderer
Collection Renderer CollectionGridRenderer
Breadcrumb Visibility Style invisible
Width Adjustment Mode standard
Height Adjustment Mode compact
Number of Rows 5
Row Spacing 15
Number of Columns 3
Column Spacing 15
Column Spacing Mode minimum
Property for Sorting no_sorting
Vertical Alignment standard
2. Create a Resource Renderer: Configuration -> Content Management -> User Interface -> Settings -> Resource Renderer Settings -> New
Use the following settings (some parameters might not exist in your SP version):
Name EntrypointsResourceRenderer
Description Resource renderer for entrypoint categories
Resource Renderer ResourceRenderer
Image Width 48
Image Height 48
Image Setting replace
Primary Text Style HEADER2
Secondary Text Style LEGEND
Child Folders' Style off
Visible Properties rnd:image(alignLeft/[1-2;1]/contentLink/space-right=10),rnd:displayname([1;2]/alignLeft/alignTop/contentLink),description(useLinkData/alignLeft/alignTop)
Command Display off
Resource Command Group Not set
Folder Command Group Not set
Link Command Group Not set
3. Create a Resource Renderer: Configuration -> Content Management -> User Interface -> Settings -> Layout Set -> New
Use the following settings (some parameters might not exist in your SP version):
Name EntrypointsExplorer
Description The entrypoint categories layout set
Enabled for presentation settings YES
Layout Controller SimpleLayoutController
Collection Renderer EntrypointsCollectionGridRenderer
Resource Renderer EntrypointsResourceRenderer
Commands for the details menu Not set
Now, you should have an 'Entrypoints Explorer' LayoutSet to choose from, so you can follow my first post.
Best regards,
Robert -
Adding Images in the Interactive Form
Dear All,
How to add a image in the standard SAP Deliver interactive forms for the PCR.
Can i able to change the logo which is available in the system to the custom logo.
So that will it get reflected in the all the standard screen using the logo.
Thanks
YogeshHi Yogeshwaran,
After u create a UI element for the Image. set the URL for the UI element value in ur coding for the Value Attribute which is bound to the Image UI element.
After setting the URL, save the URL in the back-end table so that next time the form is loaded the Custom logo is displayed
Hope this helps u
Regards,
Poojith MV -
Adding image in the header?
hi
I would like to know how I could add an image in the report on the left hand side of the header section.
And do I need to include the image in the path or where?
Please help me out
ThanksGo to file import images and import the image and then place it adjust to the size you want thats it.
Cheers
Rao -
Adding images to the header & footer in Pages for the iPad
How do I add images i.e. logos into the header and footer in Pages for the iPad.
I do not beleive Pages for iOS allows insertion of images into the header or footer, just the background of the page body. It can however be placed behind the header. (Tools icon (wrench - upper right of screen) > Document set up
-
ADDING IMAGES TO THE DASHBOARD
I would like to add our company logo to the dashboard.
How should I go about it?
Thanks.
Winny.One should not modify the Oracle Style. If something goes wrong you should have something to revert back to. Also, i am not sure whether modifying the Oracle Style is supported. You need to create a custom style(copy the oracle style as metioned in the blog entry above) and make the changes there.
Thanks,
Venkat
http://oraclebizint.wordpress.com -
Objects added to the stage are not animated by AnimatorFactory
Hi all,
the following code ist a very simple animation. I added an object to the stage by dragging it from the library. Then I applied code generated by "Copy motion as AS 3" and the animation works fine.
However, if i add another object by instating it in AS, add it to the stage by stage.addChild(...), and try to animate it by adding it as a target to the AnimatorFactory nothing happens.(Probably I made a simple newbi mistake.)
Any ideas how to fix this? Thanks a lot in advance.
Here is the code:
import fl.motion.AnimatorFactory;
import fl.motion.MotionBase;
import flash.filters.*;
import flash.geom.Point;
var __motion_Symbol1_3:MotionBase;
if(__motion_Symbol1_3 == null) {
import fl.motion.Motion;
__motion_Symbol1_3 = new Motion();
__motion_Symbol1_3.duration = 34;
// Call overrideTargetTransform to prevent the scale, skew,
// or rotation values from being made relative to the target
// object's original transform.
// __motion_Symbol1_3.overrideTargetTransform();
// The following calls to addPropertyArray assign data values
// for each tweened property. There is one value in the Array
// for every frame in the tween, or fewer if the last value
// remains the same for the rest of the frames.
__motion_Symbol1_3.addPropertyArray("x", [0,10.6348,21.2697,31.9045,42.5394,53.1742,63.809,74.4439,85.0787,95.7136,106.348,116.983 ,127.618,138.253,148.888,159.523,170.158,180.792,191.427,202.062,212.697,223.332,233.967,2 44.601,255.236,265.871,276.506,287.141,297.776,308.411,319.045,329.68,340.315,350.95]);
__motion_Symbol1_3.addPropertyArray("y", [0,-0.151515,-0.30303,-0.454545,-0.60606,-0.757575,-0.90909,-1.06061,-1.21212,-1.36364,-1 .51515,-1.66667,-1.81818,-1.9697,-2.12121,-2.27273,-2.42424,-2.57576,-2.72727,-2.87879,-3. 0303,-3.18182,-3.33333,-3.48485,-3.63636,-3.78788,-3.93939,-4.09091,-4.24242,-4.39394,-4.5 4545,-4.69697,-4.84848,-5]);
__motion_Symbol1_3.addPropertyArray("scaleX", [1.000000]);
__motion_Symbol1_3.addPropertyArray("scaleY", [1.000000]);
__motion_Symbol1_3.addPropertyArray("skewX", [0]);
__motion_Symbol1_3.addPropertyArray("skewY", [0]);
__motion_Symbol1_3.addPropertyArray("rotationConcat", [0]);
__motion_Symbol1_3.addPropertyArray("blendMode", ["normal"]);
// Create an AnimatorFactory instance, which will manage
// targets for its corresponding Motion.
var __animFactory_Symbol1_3:AnimatorFactory = new AnimatorFactory(__motion_Symbol1_3);
__animFactory_Symbol1_3.transformationPoint = new Point(0.500000, 0.500000);
// Call the addTarget function on the AnimatorFactory
// instance to target a DisplayObject with this Motion.
// The second parameter is the number of times the animation
// will play - the default value of 0 means it will loop.
__animFactory_Symbol1_3.addTarget(myClip, 0);
var myClip1:Symbol1 = new Symbol1();
stage.addChild(myClip1);
__animFactory_Symbol1_3.addTarget(myClip1, 0); // NOTHING HAPPENS?if you create an animation that you want to apply to mulitple objects in cs4, you can create a motion preset:
http://www.gotoandlearn.com/play?id=88
in your coding problem, instead of adding myClip1 to the stage, add it to the main timeline. -
Image quality when moving bitmaps around the stage
Hey all,
I am moving an image around the stage, and when it moves
quickly, it becomes distorted and displays what I can only refer to
as "banding". The image appear to be misaligned for some of the
frames that it is moving. I have tried a number of the usual fixes,
increasing the framerate, using a less complex image, etc. Nothing
seems to work. Any ideas? I feel like I have seen a lot of flash +
director movies that have fast motion, slick movement, etc and not
appear as what I end up with. Is this something that relates to a
screen refresh rate? Thanks for any ideas...
- BSounds like good old vertical sync / tearing. This is really
not a fixable
issue. You can try slowing down the movement a little...
Someone, a while
ago, worked on creating an xtra that would honor the vertical
blanking
interval, but it never really worked properly I don't
believe. You can read
all kinds of prior posts about this by searching google
groups within
macromedia.director.* for 'vertical sync'
Dave -
Head Developer
www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
After adding 5 pictures the file size is 10x bigger
Hello,
I designed a web site and added 7 pictures (all together 800kb) with layer stack and blending options.
The svg file was 320kb now it' apx. 6mb ...
how to get the file smaller?
Greetings
mamutYou can scale down images to make the file sizes lighter.
Are you using the Clipping Frame (Insert > Media Objects > Clipping Frame) to add images to your file? If so, follow these steps to resize an image. If you are just working with an image in the workspace, without the clipping frames, just use steps 5 and 6 to downsample an image.
1. Double-click on a clipping frame image to enter into editing mode. The percentage indicator on the sliding magnification bar will tell you if the source image is large (12% is a very large image!).
2. Ensure the image is selected and click the Copy button.
3. Exit image editing mode by returning to the Sheet level by clicking in the document breadcrumb.
4. Paste the image into the document. It will be very big on the stage.
5. Scale down the down to a smaller size by grabbing a corner handle and scaling the image, or using Transform and adjusting the WIDTH AND HEIGHT percentages. (Conveniently, if you input 12% into the Width or Height box (while keeping the Lock Aspect Ratio option selected) the image scales down to the same size as the clipping frame you were using previously.)
6. Double-click the image again to enter into Bitmap Image mode and select Transform > Downsample to Screen.
7. Select the image and click the Copy button, then delete the image from the stage.
8. Double-click to get back into your clipping frame.
9. Select the image already in the frame, and delete it.
10. Click the Paste button to insert the new image into the clipping frame. It should display a better percentage such as 98 or 100%.
11. Save the file. You should find the file size to be much smaller now.
OK, looking over that now it is quite the list of things to do to optimize images for the screen. Hopefully there will be an easier way to downsample or optimize images for screen and print in the next coming releases. -
Dragging the stage newbie question
I'm using Flash CS3 and wish to create a movie where the stage is a certain size but the actual content of the movie extends further than the stage. The user will be able to drag the stage from left to right to show hidden parts of the movie. Similar to the idea of a horizontal scrolling image gallery but without the scrollbar (see attached for example image). Does anyone know how this is done or where I can find a tutorial explaining how to do it?
CheersI have done this type of interaction (AS2), not left to right, but up and down, so you will have to make some adjustments.
I placed the large image on the stage converted it to a movieclip and gave it an instance name of mc_portletlist.
I then created a mask for the area I wanted the image to be visible.
This is optional, but I created a popup that tells the user what to do (btn_popup).
I then placed the code below on the actions layer.
The numbers limit the movement of the image, so if you want the user to be able to move the image around without limits, just remove them.
mc_portletlist.onPress = function()
btn_popup._visible = false;
btn_popup.onPress = function()
btn_popup._visible = false;
mc_portletlist.onMouseDown = function() {
mc_portletlist.startDrag(false,462,35,462,737);
mc_portletlist.onMouseUp = function() {
mc_portletlist.stopDrag(false);
Maybe you are looking for
-
How to call the screen in methods could u please explain
hi, how to call the screen in methods could u please explain clearly with example
-
Can't find code for std web dynpro app but can seeit's name in the package?
Hi All, We're using ECC6 and EPP 7.01 SP4. We've recently uploaded some new packages. Within one is a Portal Buyer role (1.4). I would like to access the code for one of the standard web dynros. I retrieved the name of the application from the ivi
-
When I my app on the iOS simulator, no errors occur. When I run my app on a real device all these errors appear. Please help!
-
Logical to phycal data source mapping
Hi, I am new to OracleAS. Every other server I worked with has this and it seems like it's a big part of J2EE, but I can't seem to find anywhere how to do this in OracleAS. I am trying to find a place to map my logical JNDI name that would be specifi
-
How to put "(" and ")" in String
I need to construct a String like: String a="hello"; String b="John"; String s=a+"("+b+")"; this not working since "(" and ")" doesn't recognized as a string,what is the escape character for "(" and ")"?