PDA

View Full Version : Flash: Disable Right-Click


FoxLeader
04-27-2008, 05:00 PM
Hello everyone,

I searched a bit on the forums to find a way to disable the flash right-click without setting enabled to false (I still need interaction with the object) and without putting it in a web object. I didn't find anything satisfying.

Is there any other way? (note: I can't edit the SWF to disable the right-click).

A post by Corey made back in 2004 is saying no, however is there anything new in those last four years?

Thanks a lot!
Fox

RizlaUK
04-27-2008, 06:10 PM
im needing do the same but have been putting it off, so i will be intrested to see any comments about this

sside
04-28-2008, 08:34 AM
If i read this post correctly, you want to disable the right click. I remember time ago posting here DisableMouse.dll. One of the functions (DisableRightClick) could do the job. See if it does what you're after.

With Kind Regards
sside

RizlaUK
04-28-2008, 10:35 AM
yes, used with worms "IsInRect" function this could be just the ticket


EDIT, yup, just the ticket


put in global
function IsInRect(m_nX, m_nY, m_tblPos, m_tblSize)
local bReturn = false;
if (m_nX >= m_tblPos.X) and (m_nX <= m_tblPos.X + m_tblSize.Width) then
if (m_nY >= m_tblPos.Y) and (m_nY <= m_tblPos.Y + m_tblSize.Height) then
bReturn = true;
end
end
return bReturn;
end

put in on mouse move event
if IsInRect(e_X, e_Y, Flash.GetPos("Flash1"), Flash.GetSize("Flash1")) then
DLL.CallFunction("AutoPlay\\Docs\\DisableMouse.dll", "DisableRightClick", 1, DLL_RETURN_TYPE_LONG, DLL_CALL_CDECL);
else
DLL.CallFunction("AutoPlay\\Docs\\DisableMouse.dll", "DisableRightClick", 0, DLL_RETURN_TYPE_LONG, DLL_CALL_CDECL);
end

Thanks sside :yes

FoxLeader
04-28-2008, 11:22 AM
Wow, that's outstanding. Thanks a lot guys :)

FoxLeader
04-28-2008, 04:17 PM
Do any of you have that DLL? I found the topic here: http://www.indigorose.com/forums/showthread.php?t=18732 but it's down, and I haven't been able to find it in any of your ".Net extensions" volumes.

Thanks again! (When I'll have done what I wanted, I hope you'll like it as I do :))

sside
04-28-2008, 05:05 PM
DisableMouse library thread is updated.

DisableMouse.dll can also can be found at Ams .Net Extensions Volume 1
http://indigorose.com/forums/showthread.php?t=20220&highlight=DisableMouse

With Kind Regards
sside

FoxLeader
04-28-2008, 05:11 PM
I did a search in the forums and didn't find it. Anyway, thanks a lot! :yes

RizlaUK
04-28-2008, 05:31 PM
soz, i had it in my sside folder and dident think to post it

FoxLeader
04-28-2008, 05:59 PM
np ;)

Isn't it possible to dynamically add that code to the page's event?

Here's what I got (I tried it on page's On Show):
sCurrentActivePage = Application.GetCurrentPage();

-- Get the script existing in the event
sPreviousPageScript = Application.GetPageScript (sCurrentActivePage, "On Mouse Move");

-- Set the AddToPageScript value
sAddToPageScript = "if IsInRect(mouseX, mouseY, Flash.GetPos(\"Flash1\"), Flash.GetSize(\"Flash1\")) then DLL.CallFunction(\"AutoPlay\\Components\\mouse.dll\", \"DisableRightClick\", 1, DLL_RETURN_TYPE_LONG, DLL_CALL_CDECL); else DLL.CallFunction(\"AutoPlay\\Components\\mouse.dll\", \"DisableRightClick\", 0, DLL_RETURN_TYPE_LONG, DLL_CALL_CDECL);end"

-- Add the mouse move and flash right click disable to the end
sNewPageScript = sPreviousPageScript .. "\r\n" ..sAddToPageScript;

-- Set the event's script
Application.SetPageScript(sCurrentActivePage, "On Mouse Move", sNewPageScript );

I figured that since e_X and e_Y are local variables (aren't they?) I couldn't use them On Show so I added this to On Mouse Move:
mouseX = e_X
mouseY = e_Y
But this doesn't work either... any idea?

RizlaUK
04-28-2008, 06:16 PM
ok, in the script you add to the page, remove ";", << is the lua character for EOL (end of line, this tells the lua engine thats its the end of the line of code)

try this
sCurrentActivePage = Application.GetCurrentPage();

-- Get the script existing in the event
sPreviousPageScript = Application.GetPageScript (sCurrentActivePage, "On Mouse Move");

-- Set the AddToPageScript value
sAddToPageScript = "mouseX = e_X \r\n mouseY = e_Y \r\n if IsInRect(mouseX, mouseY, Flash.GetPos(\"Flash1\"), Flash.GetSize(\"Flash1\")) then \r\n DLL.CallFunction(\"AutoPlay\\Components\\mouse.dll\", \"DisableRightClick\", 1, DLL_RETURN_TYPE_LONG, DLL_CALL_CDECL)\r\n else \r\n DLL.CallFunction(\"AutoPlay\\Components\\mouse.dll\", \"DisableRightClick\", 0, DLL_RETURN_TYPE_LONG, DLL_CALL_CDECL)\r\n end"

-- Add the mouse move and flash right click disable to the end
sNewPageScript = sPreviousPageScript .. "\r\n" ..sAddToPageScript;

-- Set the event's script
Application.SetPageScript(sCurrentActivePage, "On Mouse Move", sNewPageScript );

FoxLeader
04-28-2008, 06:24 PM
This didn't work :s

I'll post an apz in a few minutes.

RizlaUK
04-28-2008, 06:38 PM
here, this works :yes

sCurrentActivePage = Application.GetCurrentPage();

-- Get the script existing in the event
sPreviousPageScript = Application.GetPageScript (sCurrentActivePage, "On Mouse Move");

-- Set the AddToPageScript value
sAddToPageScript =[[
if IsInRect(e_X, e_Y, Flash.GetPos("Flash1"), Flash.GetSize("Flash1")) then
DLL.CallFunction("AutoPlay\\Docs\\DisableMouse.dll", "DisableRightClick", 1, DLL_RETURN_TYPE_LONG, DLL_CALL_CDECL);
else
DLL.CallFunction("AutoPlay\\Docs\\DisableMouse.dll", "DisableRightClick", 0, DLL_RETURN_TYPE_LONG, DLL_CALL_CDECL);
end
]]
-- Add the mouse move and flash right click disable to the end
sNewPageScript = sPreviousPageScript .. "\r\n" ..sAddToPageScript;

-- Set the event's script
Application.SetPageScript(sCurrentActivePage, "On Mouse Move", sNewPageScript );

FoxLeader
04-28-2008, 06:51 PM
I'm having an error !?!
"attempt to index local 'm_tblPos' (a nil value)"
Here's also the stripped-down *.apz.

EDIT: Now it is :)
EDIT2: Sorry, now it's the good one.

RizlaUK
04-28-2008, 07:02 PM
you dident set the right name in the script, the object you created is called "CoverFlow" and the object in the script is called "Flash1"

edit, sorry...change "Flash1" to "jsdakjdasadsdgdfkglka" ... lol, like the name

edit...again

thats pertty dam neat, just having a little play.....i like it

FoxLeader
04-28-2008, 07:03 PM
Lol. I forgot I had changed that *cough*.
:lol

In fact the object name is "jsdakjdasadsdgdfkglka".

RizlaUK
04-28-2008, 07:24 PM
ok....again in english plz :D

lol

FoxLeader
04-28-2008, 07:35 PM
:lol

That's a temp name until I add the little bit of code to give it a unique random name ;)

RizlaUK
04-28-2008, 07:45 PM
lmao...untill...

you cant get any more unique and random than that.....can you, lol

FoxLeader
04-28-2008, 08:03 PM
Sure! ;)

Anyway, I finished this and learn some things... like read at least a hundred times the most stupidest details when debugging!

Anyway, now this advanced a lot tonight so I'll have some things to show soon ;)