Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
717 views
in Technique[技术] by (71.8m points)

jquery - Click to Flash object via JavaScript

Is it possible to trigger click event on Flash object via JavaScript?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Yes and no. You can use the ExternalInterface to simulate click events in your Flash project, provided they don't care about the event source (i.e. human or not).

However, one of the features in Flash that's particularly obtuse about the click event source is the File Selection dialog. It's not possible to trigger that without a real click from a real user (as far as the browser is concerned); this would actually be a potential security risk if possible. If I remember correctly, this was possible before FP 9 and we exploited this behavior for our file uploader. This started to cause issues once they fixed it, but I'm glad they did so :)

The typical way to overcome this limitation is by creating a transparent Flash object and positioning a layer over it that shows a button image; the click event will eventually hit the Flash object and trigger a user click event.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...