The tool shownwe are the future...

actionscript 3 - Flash Senocular Transform Tool - controls are not showing on the tool - Stack Overflow
to customize your list.
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
J it only takes a minute:
Join the Stack Overflow community to:
Ask programming questions
Answer and help your peers
Get recognized for your expertise
I am having trouble with the controls showing up for my transform tool. When I click my image I get the bounding box (to scale or rotate the image), but when I hover over the corner I do not get the cursor to transform it.
I am using these files:
This is my code to call the transform tool:
var tool:TransformTool = new TransformTool();
addChild(tool);
And this later on to make the tool show up when the image is clicked and make the tool disappear when the stage is clicked:
tmpImage.addEventListener(MouseEvent.CLICK, select);
function select(e:MouseEvent):void {
tool.target = e.currentTarget as S
stage.addEventListener(MouseEvent.MOUSE_DOWN, deselect);
function deselect(e:MouseEvent):void {
tool.target =
tmpImage.addEventListener(MouseEvent.CLICK, select);
My image selection for the bounding box to appear and disappear work perfectly. All my code works as expected.... except the actual controls on the bounding box. Please help!
The concept is the user can click an image from a menu and drag a new instance of that image to the stage. Then the user can click the new instance and should be able to rotate or scale it. Then they can click off the image to make the bounding box disappear.
(They can add as many images to the stage that they want).
Here is some code that shows the basic click, create new instance, and drag process I have implemented.
//sb1 is the menu area that contains a group of images
//hill is one of the images the user can add to the stage
sb1.hill.addEventListener(MouseEvent.MOUSE_DOWN, createCopy);
var i:int=0;
var tmpImage:S //to store which image is being dragged currently
function createCopy(e:MouseEvent):void {
tmpImage = new Hill_mc();
tmpImage.name = "hillChild"+(i++); //increment every copy
container.addChild(tmpImage);
tmpImage.x = mouseX-470;
tmpImage.y = mouseY-270;
tmpImage.startDrag();
tmpImage.addEventListener(MouseEvent.MOUSE_DOWN, onDown); //add the mouse down to this new object
stage.addEventListener(MouseEvent.MOUSE_UP, onUp); //since the mouse is currently down, we need to listen for mouse up to tell the current copy to stop dragging
//this will be called when click a copy
function onDown(e:MouseEvent):void {
tmpImage = Sprite(e.currentTarget); //get a reference to the one that was clicked, so we know which object to stop dragging on the global mouse up.
container.addEventListener(MouseEvent.MOUSE_UP, onUp); //listen for the mouse up
tmpImage.startDrag();
function onUp(e:MouseEvent):void {
container.removeEventListener(MouseEvent.MOUSE_UP,onUp);
if (tmpImage.hitTestObject(thesubmenu1)) {
container.removeChild(tmpImage);
tmpImage.stopDrag();
tmpImage.addEventListener(MouseEvent.CLICK, select);
function select(e:MouseEvent):void {
tool.target = e.currentTarget as S
tmpImage.addEventListener(MouseEvent.MOUSE_DOWN, deselect);
function deselect(e:MouseEvent):void {
tool.target =
tmpImage.addEventListener(MouseEvent.CLICK, select);
I found this code and placed it in my TransformTool.as. I feel like it's so close and that there must be something called incorrectly because I get an error for a null object reference:
public function select(event:Event):void {
// the selected object will either be the
// event target or current target. The current
// target is checked first followed by target.
// The parent of the target must match the
// parent of the tool to be selected this way.
if (event.currentTarget != this
&& event.currentTarget.parent == parent){
setTarget(event.currentTarget as DisplayObject, event);
}else if (event.target != this
&& event.target.parent == parent){
setTarget(event.target as DisplayObject, event);
* Helper selection handler for deselecting target objects. Set this
* handler as the listener for an event that would cause the
* deselection of a target object.
* It is not required that you use this event handler. It is only a
* helper function that can optionally be used to help ease
* development.
public function deselect(event:Event):void {
if (_target != null && event.eventPhase == EventPhase.AT_TARGET){
setTarget(null, null);
You give too little information to determine what exactly is wrong.
However, there is a very good sample code that does exactly what you want here :
(Click on the link at the bottom of the image.)
I am sure that you are going to make it with this.
Try to use the built-in handlers. I would do something like this :
Instead of this :
tmpImage.addEventListener(MouseEvent.CLICK, select);
function select(e:MouseEvent):void {
tool.target = e.currentTarget as S
stage.addEventListener(MouseEvent.MOUSE_DOWN, deselect);
function deselect(e:MouseEvent):void {
tool.target =
tmpImage.addEventListener(MouseEvent.CLICK, select);
tmpImage.addEventListener(MouseEvent.MOUSE_DOWN, tool.select);
stage.addEventListener(MouseEvent.MOUSE_DOWN, tool.deselect);
If you do not have the handlers, I am not sure :) but I would recommand removing event listeners in each method as they might be interfering with each other.
tmpImage.addEventListener(MouseEvent.CLICK, select);
function select(e:MouseEvent):void {
tmpImage.removeEventListener(MouseEvent.CLICK, select);
tool.target = e.currentTarget as S
stage.addEventListener(MouseEvent.MOUSE_DOWN, deselect);
function deselect(e:MouseEvent):void {
stage.removeEventListener(MouseEvent.MOUSE_DOWN, deselect);
tool.target =
tmpImage.addEventListener(MouseEvent.CLICK, select);
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabledMIMOA is the BEST WORLDWIDE architecture guide. Let us show you why.
MIMOA has all the information you need to find and visit architecture around the world. It is a user generated website, which means all information is published by the visitors. It is a great way to help others to find your projects. And since basic tools are free, there's no reason not to explore further...
everybody can
... search and browse the database
The search box, just above the map, gets you everywhere you need to go. It consists out of a search engine, browse link and a popular cities menu.
Search: enter a keyword at -1-, choose a category to search for at -2- and click the 'find' button at -3-.
If you don't exactly know what you're looking for, but just want to get an overview and choose, then use the 'browse' link to look directly into our database. The 'popular cities' menu offers a short cut to some of MIMOA's most popular destinations.
... place comments on a project
Everybody can write a
to share your personal experience, additional information or recommendations.
You can even add a HTML LINK or a YOU-TUBE VIDEO.
For links, make sure to enter: &a href=&http://URL/& target=&_blank&&name of the link&/a&
For You-Tube embeds simply copy-paste the embed code that you find on the You-Tube website into the comments-box.
You do not need to login before commenting, but if you do, your screen-name will link to your personal profile, where visitors can read more about you, and see more of your contributed projects.
You'll find the comment-box at the bottom of the project-page.&
on our weblog.
... easily tell a friend about a project
a project you&ve seen on MIMOA by clicking the button on the upper right corner of a project-page.&
... see all projects in Google Earth (with KMZ)
Yes, this one is a frequently requested feature. You can download the Google Earth Placemark files (KMZ) to your computer, so you can explore MIMOA's projects in Google Earth and Google Maps.
THE KMZ-FILE HERE, WITH ALL MIMOA PROJECTS IN IT
or go to Menu && Projects && MIMOA KMZ and download it there
Why would you need KMZ files? Because in Google Earth you can view 3D buildings in several cities, including San Francisco, Amsterdam, Boston, Munich, Zurich and dozens more.
You can use the extra layers to show (or hide) local points of interest and facts. Even better: view driving directions and even fly along your self-created routes. And much more.
on our weblog.
... share a project on other social media
Add the link to this project to any of the following 6 community sites, and share the best of MIMOA with the rest of& the world.
... subscribe to our RSS feeds
On the Latest Additions.
Easily follow all the updated and contributed projects on MIMOA and subscribe to the free RSS feed on our . The RSS document contains a summary of the project-data that is published online. Click on the orange RSS icon on the , or at the top of the
To read all comments.
If you're into a specific project, and want to read all relevant comments that are placed you can keep up with the conversation by subscribing to the free RSS feeds on the comments. You'll find the RSS icon next to the green comments-box on the page of the selected project.
On our weblog.
And of course, you can
- keeping you up to date on our latest developments.
Not yet familiar with RSS feeds? Read this article on .
... include MIMOA in your iGoogle widget
Personalize your iGoogle homepage and include MIMOA&s latest 5 additions! Never again miss out on a new publication on MIMOA.
to implement this widget on your iGoogle homepage, or .
... place a direct link to a project on MIMOA
You can place a link to a specific project on MIMOA with the 'See this project on MIMOA button', simply copy and paste the code to your weblog, news or press-section on your own website. You can find this tool in the lower left corner of a project-page.
... use our special buttons to 'Link to MIMOA'
You can place a
with a button of your choice in your weblog or newsitem. This way you can easily refer to MIMOA, &nd have a recognizable link to our homepage.
Simply choose a button, copy the code and paste it into your site. You can find the buttons .
registered users can
... contribute projects
Registered users publish projects with the interactive online upload form - free! You can save your project temporarily and complete the data later. When you&re finished and submit the project it is sent to MIMOA for review. See your personal overview to check the status of your projects. You will be notified by email when the project is online.
You&ll find the upload form (after login) , under the MENU && PROJECTS && Add a project.&&
... create a personal Mi guide
To ensure you have all necessary information at hand while you are traveling, you can prepare yourself by making your own personal Architecture Guide. Select projects, set them in a convenient order, and make a pdf or print it.
You can make your guide public and share it with others. You'll get an
under the MENU &&
GUIDES. Read more
on our weblog.
Unfortunately we can not (yet) include a map to the PDF since Google Maps does not allow us to print their maps.
... rate projects
Registered users can rate the projects by clicking a green &star& in the right column on a project-page. The more stars, the higher the rating. Why rate a project? So the most popular projects will float to the surface. They will be shown in the list of . Why register? To ensure an honest result.
on our weblog.
... create a personal profile
Every registered user has a personal profile. All your contributed projects will be linked to this profile.
Edit your profile and add information about yourself and explain the viewers where you live, what are your interests, background or profession... You can use html code in the text box for text-editing and a a personal photo or logo.
In your personal profile you can choose which information is public, and whether or not you want to receive an email every time one of your contributed projects is commented by others.
You can find your profile (after login) under the MENU && MI PAGES& &&& MI PROFILE
Read more about the
on our weblog.
... mark where you've been and bookmark your favorites
Registered users can choose their favourite projects, and a shopping chart if you like. This way you have your personal pearls of architecture close at hand, to show others, or make a short selection of projects you intend to visit soon. These projects turn pink on the map.
When you come back from a tour and visited several projects in real life, you can mark them 'Mi was here'. These projects turn green on the map. This way you&ll find a perfect overview on the map on all your visited projects and places, so you can plan where to go next.
All other viewers can see these lists on your personal profile. You can remove a favourite / &Mi was here& from the list by clicking the &remove& button (this will not delete a project from the website).
mobile tools
We're created several ways to take the whole MIMOA database with you,
while you are exploring your city. Use these tools:
MIMOA is the perfect travel mate!
iPHONE APPLICATION
MIMOA features over 4000 buildings, interiors, squares, parks and bridges around the world. The extensive (and growing!) database is also available as a mobile travel guide: on the iPhone. With exact locations, photos and detailed information the MIMOA iPhone app puts everything you need at your fingertips.
MIMOA is the best source of information with all Modern Architecture in one view, and now we've launched the best travel mate for architecture lovers.
Want to read more?
MIMOA LAYAR on your smartphone
Let Layar take your there!
Download Layar at the Android Market, the App Store or with iTunes, select the MIMOA layer and enjoy an &Architecture Enriched Reality&.
Layar is a free application on your mobile phone which shows what is around you by displaying real time MIMOA information on top of reality, through the camera of your mobile phone. It is a new kind of browser for smart&phones.
By holding the phone in front of you like a camera, you can see& information of the architecture around you. For all points of interest which are displayed on the screen, information about the building is shown at the bottom of the screen. You can see how far away the building is located and where to go. A perfect travel mate!
For this complex functionality the supported devices not only need to have a camera, GPS sensor and inter&net connectivity, further&more a compass and an accelero&meter are necessary. For this reason only Android driven smartphones and the iPhone 3GS and iPhone 4 are supported by Layar right now. (Older iPhone models don&t have an integrated compass).&
Read all about the MIMOA Layar
Let TomTom drive you there!
Add projects to your TomTom navigation device.
Click on the 'Add to TomTom' button and download the address and some basic information of a project onto your TomTom device, and navigate directly towards your architectural destination.
You can find the button next to the address, on the page of the selected project.
about the 'add to TomTom button' on our weblog.
Tools yet to be developed
We're constantly working on updates and new features. Here's a small preview of things to come!
MIMOA WIDGETS
Soon to be developed: integrate MIMOA content on your website.
MIMOA CITY INFO
Soon to be developed: . We will assemble all necessary, interesting, hard to find, undisclosed information which you can not find in the 'main stream tourist guides', and conveniently orden this information for every major architectural destination. All user generated info, off course.
Add Rich Point Of Interest to TomTom
With this feature you'll be able to add several projects onto your TomTom device & all at once. Download your Mi guide or other selections of projects that you want to visit. Your TomTom will show these Points of Interest (POI's) with images and accompanying text (description, opening hours, etc &), aside from lat-long coordinates.
Perfect for your architectural excursion, and what's more: the route between the POI is automatically complemented by whatever TomTom information you normally get along the way. Such as traffic, weather, safety cameras and more.

我要回帖

更多关于 we are the future 的文章

 

随机推荐