flash banner link not working - AS 2.0 - actionscript-2

This post had some easy to follow instructions to make a flash banner clickable, but it's not quite working for me.
http://www.austintreeexperts.com/maps/oakwilt.cfm is where my flash banner is. Under the google earth thing is a small flash ad. When I mouse over, the cursor turns to pointer like it knows it's a link, but clicking does nothing. I've been fooling with this for hours and I'm about to go crazy. My actionscript is this:
on(press){getURL("http://realgreenlawn.com","_blank");}

First thing to consider:
Are you using a button symbol? If so you will get a hand cursor whether or not the onPress() code is correct. You should use a movieclip symbol instead, with your over, up, and down states as frame label names "_up", "_over" and "_down". Those frame names will make a movieclip act like a button instance as long as you have an onRelease() or onPress() method assigned to it as outlined below. Also, to get a hand cursor you will need to set useHandCursor to true.
Second thing to consider:
Your onPress() code looks like its the kind of code placed right on a movieclip. If so, do not do that! Give it an instance name, like myButton and use the code below on the same frame the button resides:
myButton.useHandCursor = true;
myButton.onRelease = function()
{
getURL("http://realgreenlawn.com","_blank");
}
or alternatively and not best practice, but easier if your aren't that skilled with as2 is to put the above code on the first frame inside your button movieclip, but if you do that change it to:
this.useHandCursor = true;
this.onRelease = function()
{
getURL("http://realgreenlawn.com","_blank");
}

Related

CreateJS pressup/click won't trigger when target movie is played on mousedown/pressmove

I have a project where I need to make flash movie as an interactive game. Because, flash is already (or soon will be) obsolete for most of browsers, I've decided this game must be based on HTML5/JS. Because most of the graphics and animations are already done in this Flash movie (and I have its source), I'm developing it using Adobe Flash and CreateJS technology (HTML5 + Canvas + JS). So far, I like this solution pretty much, though I have an issue which I could not solve yet.
The game is a simple drag&drop matching game. The problem I have is shortly described in the question title and I will try to explain it here more detailed:
label.on('mousedown', function() {
//this.image.bg.gotoAndStop(2);
});
label.on('pressmove', function(evt) {
this.x = getStageX(evt.stageX);
this.y = getStageY(evt.stageY);
currentStage.setChildIndex(this, currentStage.getNumChildren() - 1);
stage.update();
});
label.on('pressup', function(evt) {
console.log('Hi! I'm mouseup event!')
this.x = labelInitX;
this.y = labelInitY;
this.image.bg.gotoAndStop(0);
});
Above, you can see simplified 3 event handlers I use. Everything is working fine until I uncomment second line - //this.image.bg.gotoAndStop(2);. When I do this, the pressup event does not trigger mostly, which is rather strange, because some times it does trigger (2-3 times out of 10), so the label sticks with the pointer until I press the button again.
Is this some bug or I simply does not understand something about the CreateJS and its event handlers. I tried different combinations of this. Used click instead of pressup, placing this.image.bg.gotoAndStop(2); inside the pressmove handler. Replacing pressmove handler with the stage.on('stagepressmove', handler). None did not work. this.image.bg.gotoAndStop(2); - this thing simply updates the timeframe (change the background image of the label). I do can change this image programatically (without playing timeframes) and I'm almost sure that the issue will be fixes, though I'd like to understand for myself what is wrong here or what I'm doing wrong with the event handlers.
Another, less important thing, but would be useful to know is why when pressmove event is running, the CreateJS objects stop receiving event triggers about rollover or mouseover? In DOM, by default event bubbling is working until you stop it with stopPropagation. How does it work here with CreateJS? Seems that bubbling is simply turned off here by default. How can I turn it on?
I thought I might shed some light on what I think is going on.
The normal mouse events "click", "mouseup", "rollover", "rollout", etc all function by the stage determine what the "target" of the mouse event was by default the target is the lowest-level thing that is interacted with. If you contents change while the mouse is down, it will not count as the same target when the mouseup occurs. Since positions are not re-checked without moving the mouse, the mouseover, mouseout, rollover, and rollout events may function oddly as well.
Conversely, the "pressmove" and "pressup" events do not care what is under the mouse once something is pressed. The target will always be what was pressed, which allows you to move the mouse out of the object (or even remove it), and still receive events from it. This also ensures that you receive a pressup event even if you release outside the object.
As #RandyPrad mentioned, the hitArea may solve your issue. By specifying a hit area, you are overriding the contents of your clip, so your target should always be the container (MovieClip) instead of its contents. That way no matter what is pressed inside the movieclip, it is the same target when you release. You can also get the same effect using the mouseChildren property.
movieClip.mouseChildren = false;
Hope that helps!
Please check your hit area of the button.
i think that your are playing image inside the btn is animating
please use this link http://www.createjs.com/tutorials/Mouse%20Interaction/hitArea.html

NSSavePanel appears differently between applications, even with identical code

I was having trouble with an NSSavePanel in my project, so to try to isolate the problem, I created a test project that included only the NSSavePanel code in the default window's viewDidLoad.
Test Project
The code I used to show the NSSavePanel:
dispatch_async(dispatch_get_main_queue()) {
let savePanel = NSSavePanel()
savePanel.nameFieldStringValue = "test.png"
let result = savePanel.runModal()
if result == NSFileHandlingPanelOKButton {
print("You hit that OK button.")
}
}
The save panel that appears looks like this:
The Real Project
When I use the same code (except the image file name) in my existing application, I get an NSSavePanel that appears like this:
Key differences:
The window that appears doesn't become active
The title bar isn't separate from the rest of the window
Whenever you click on something that isn't a button or a text field, the window jumps down the screen a few pixels, as though I intended to drag it around.
What in the world is happening here? Clearly the problem is bigger than just that snippet of code. Does anyone have any idea what it is?

Camera rotation at three js not working proper?

I am using this function and it is not working properly. Coding is using three.js
function rotate(){
camera.rotation.x+=0.1;
}
. If I add this at the render function it works just once and not correct meaning that the rotate function event on mouse movement I have, rotates wrong or maybe at an other centre.
What I need is to rotate the camera on the x,y,z axes when the button is clicked.
Any ideas?
You defined controls. They decide the camera rotation instead of the line you added. You have to set controls.enabled=false when you want the camera to rotate.
Yo can’t rotate the camera if you later call controls.update(), OrbitControls will overwrite anything what you have applied.
So one simple solution is to not update the controls if you are transforming the camera by yourself.
As the previous answers said the OrbitControls overwrite anything
But it looks like three.js now doesn't need to call controls.update() as long as you instantiated it const controls = new OrbitControls(camera, renderer.domElement); it will work fine and won't interfere with the camera.
source

Magnific popup - put arrows inside of an image

I put magnific popup to my site, to display Images in gallery. I love this tool, except one thing. The arrows for changing of images are displayed on the sides of screen, what is little bit inpractical when you have big screen with big resolution. So I want to ask if it is possible to move the arrows inside the image, as it is common for many other image viewiers such as lightbox and so on.
Thank you in advance.
You may just re-append the arrows inside container, here is example http://codepen.io/dimsemenov/pen/JGjHK
I had an issue when building multiple gallery from database. One gallery contained an unique picture and with callback : this.contentContainer.append(this.arrowLeft.add(this.arrowRight));
this picture just won't display (you get an error on this.arrowLeft undefined or Null)
(try it on the codepen example, just erase the second picture from the DOM.You'll see the remaining image can't be opened)
To fix this, i used the following callback instead :
this.contentContainer.append(this.arrowLeft,this.arrowRight);
#raison, this should work with type inline/iframe:
callbacks: {
buildControls: function() {
// re-appends controls inside the main container
this.arrowLeft.appendTo(this.contentContainer);
this.arrowRight.appendTo(this.contentContainer);
}
}

SL 4: ScrollViewer - RequestBringIntoView

How can I find the component in a ScrollViewer that handles the RequestBringIntoView event?
It isn't exposed on the two ScrollBar parts (not directly, anyway).
Thanks for any pointers...
UPDATE: Related: Can I get the ScrollContentPresenter part of the ScrollViewer? How?
Thanks --
Bigger picture:
We have a large Canvas contained in a ScrollViewer. At runtime, an arbitrary number of UserControls (I'll call them 'Blobs') are added to the canvas from the db. Their position and content come from the db. A user can 'select' a blob by clicking on it, and its appearance changes to indicate it is selected.
If the user uses a scrollbar to move the selected blob out of view, then clicks on another blob, the Canvas is scrolled so the previously-out-of-view blob is in view again. I assume this is due to some object raising the RequestBringIntoView, and the ScrollViewer is handling it.
Hope this makes sense...
Yet more info:
Added a handler (sb_ValueChanged) to the Scrollviewer's scrollbar ValueChanged event. Here's the stack from the mouse click that precipitates the scrolling:
OurControl.sb_ValueChanged() System.Windows.dll!System.Windows.Controls.Primitives.RangeBase.OnValueChanged() System.Windows.dll!System.Windows.Controls.Primitives.ScrollBar.OnValueChanged() System.Windows.dll!System.Windows.Controls.Primitives.RangeBase.OnValuePropertyChanged()
System.Windows.dll!System.Windows.DependencyObject.RaisePropertyChangeNotifications()
System.Windows.dll!System.Windows.DependencyObject.UpdateEffectiveValue()
System.Windows.dll!System.Windows.DependencyObject.SetValueInternal()
System.Windows.dll!System.Windows.DependencyObject.SetValue()
System.Windows.dll!System.Windows.Controls.ScrollViewer.InvalidateScrollInfo() System.Windows.dll!System.Windows.Controls.ScrollContentPresenter.VerifyScrollData()
System.Windows.dll!System.Windows.Controls.ScrollContentPresenter.ArrangeOverride()
System.Windows.dll!System.Windows.FrameworkElement.ArrangeOverride()
If only I could find out what the FrameworkElement that starts the mischief actually is...
Sorry... it doesn't seems to exist like it does in WPF. Check this link for a handy solution.
Update: Ok... for this you might need to walk the visual tree and some sort of recursive search need to be done. However, assuming you are using the default template for the scrollviewer as seen here, you can directly ask for the ScrollContentPresenter with something like this:
var BorderChild = VisualTreeHelper.GetChild(MyScrollViewer, 0);
var GridChild = VisualTreeHelper.GetChild(BorderChild, 0);
var ScrollContentPresenterChild = VisualTreeHelper.GetChild(GridChild, 0);