{"id":256,"date":"2010-03-22T13:05:39","date_gmt":"2010-03-22T18:05:39","guid":{"rendered":"http:\/\/billdwhite.com\/?p=256"},"modified":"2019-02-14T21:04:00","modified_gmt":"2019-02-14T21:04:00","slug":"spark-physics-with-flex-4-components-and-box2d","status":"publish","type":"post","link":"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/","title":{"rendered":"Spark Physics with Flex 4 Components and Box2D"},"content":{"rendered":"<p>A while back I created a <a href=\"http:\/\/billdwhite.com\/?p=26\">few<\/a> <a href=\"http:\/\/billdwhite.com\/?p=25\">demos<\/a> showing how to combine ActionScript physics engines (as well as 3d engines) with Halo components to create a physics-enabled UI. I wanted to see what could be done using the new Flex 4 Spark components and I was very surprised to find that almost nothing had been posted about using physics engines with Flex 4.<!--more--><\/p>\n<p>So I decided to put something together myself. Nothing ground-breaking here, but this demo uses the Box2D 2.0 physics engine and combines it with Spark buttons using some ideas I&#8217;ve taken from <a href=\"http:\/\/isfland.com\">Eugene Karataev<\/a> (<a href=\"http:\/\/translate.google.com\/translate?hl=en&amp;sl=ru&amp;tl=en&amp;u=http%3A%2F%2Fisfland.com%2F\">translated<\/a>) and his demo using Flex 3 called <a href=\"http:\/\/isfland.com\/lab\/boxui\/boxui.html\">FallenUI<\/a>.<\/p>\n<p><strong>This demo shows some Spark buttons that become physics-enabled once you click the &#8216;Start Simulation&#8217; button. You can also drag them around and toss them into each other<\/strong>. I&#8217;m sure there is a better way to integrate Flex 4 and Box2D, but this is just a quick and dirty attempt to see if I could get it working with no Halo components involved. Of course, the source is also available from the context menu. Let me know what you think. \ud83d\ude42<\/p>\n<p><a href=\"http:\/\/billdwhite.com\/wp-content\/demos\/SparkPhysicsDemo\/srcview\/index.html\">View Source<\/a><\/p>\n<p align=\"center\"><div id=\"afe-swf-1\" class=\"afe-flash\">Flash Player Required to view this demo.<\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A while back I created a few demos showing how to combine ActionScript physics engines (as well as 3d engines) with Halo components to create a physics-enabled UI. I wanted to see what could be done using the new Flex 4 Spark components and I was very surprised to find that almost nothing had been\u2026 <span class=\"read-more\"><a href=\"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-256","post","type-post","status-publish","format-standard","hentry","category-adobe-flex"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Spark Physics with Flex 4 Components and Box2D - Bill White<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spark Physics with Flex 4 Components and Box2D - Bill White\" \/>\n<meta property=\"og:description\" content=\"A while back I created a few demos showing how to combine ActionScript physics engines (as well as 3d engines) with Halo components to create a physics-enabled UI. I wanted to see what could be done using the new Flex 4 Spark components and I was very surprised to find that almost nothing had been\u2026 Read More &raquo;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/\" \/>\n<meta property=\"og:site_name\" content=\"Bill White\" \/>\n<meta property=\"article:published_time\" content=\"2010-03-22T18:05:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-02-14T21:04:00+00:00\" \/>\n<meta name=\"author\" content=\"Bill White\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bill_d_white\" \/>\n<meta name=\"twitter:site\" content=\"@bill_d_white\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bill White\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/\"},\"author\":{\"name\":\"Bill White\",\"@id\":\"https:\/\/billdwhite.com\/wordpress\/#\/schema\/person\/ea6b87554d0eed13a0152765dd01d314\"},\"headline\":\"Spark Physics with Flex 4 Components and Box2D\",\"datePublished\":\"2010-03-22T18:05:39+00:00\",\"dateModified\":\"2019-02-14T21:04:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/\"},\"wordCount\":213,\"commentCount\":13,\"publisher\":{\"@id\":\"https:\/\/billdwhite.com\/wordpress\/#\/schema\/person\/ea6b87554d0eed13a0152765dd01d314\"},\"articleSection\":[\"Adobe Flex\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/\",\"url\":\"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/\",\"name\":\"Spark Physics with Flex 4 Components and Box2D - Bill White\",\"isPartOf\":{\"@id\":\"https:\/\/billdwhite.com\/wordpress\/#website\"},\"datePublished\":\"2010-03-22T18:05:39+00:00\",\"dateModified\":\"2019-02-14T21:04:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/billdwhite.com\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Spark Physics with Flex 4 Components and Box2D\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/billdwhite.com\/wordpress\/#website\",\"url\":\"https:\/\/billdwhite.com\/wordpress\/\",\"name\":\"Bill White's Blog\",\"description\":\"UI Development and Data Visualization:  Angular \/ React \/ D3 \/ Typescript \/ Javascript \/ UI \/ UX \/ Etc\",\"publisher\":{\"@id\":\"https:\/\/billdwhite.com\/wordpress\/#\/schema\/person\/ea6b87554d0eed13a0152765dd01d314\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/billdwhite.com\/wordpress\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/billdwhite.com\/wordpress\/#\/schema\/person\/ea6b87554d0eed13a0152765dd01d314\",\"name\":\"Bill White\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/billdwhite.com\/wordpress\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3c3595ee8305a186eea4ea5286143893?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3c3595ee8305a186eea4ea5286143893?s=96&d=mm&r=g\",\"caption\":\"Bill White\"},\"logo\":{\"@id\":\"https:\/\/billdwhite.com\/wordpress\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/www.billdwhite.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spark Physics with Flex 4 Components and Box2D - Bill White","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/","og_locale":"en_US","og_type":"article","og_title":"Spark Physics with Flex 4 Components and Box2D - Bill White","og_description":"A while back I created a few demos showing how to combine ActionScript physics engines (as well as 3d engines) with Halo components to create a physics-enabled UI. I wanted to see what could be done using the new Flex 4 Spark components and I was very surprised to find that almost nothing had been\u2026 Read More &raquo;","og_url":"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/","og_site_name":"Bill White","article_published_time":"2010-03-22T18:05:39+00:00","article_modified_time":"2019-02-14T21:04:00+00:00","author":"Bill White","twitter_card":"summary_large_image","twitter_creator":"@bill_d_white","twitter_site":"@bill_d_white","twitter_misc":{"Written by":"Bill White","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/#article","isPartOf":{"@id":"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/"},"author":{"name":"Bill White","@id":"https:\/\/billdwhite.com\/wordpress\/#\/schema\/person\/ea6b87554d0eed13a0152765dd01d314"},"headline":"Spark Physics with Flex 4 Components and Box2D","datePublished":"2010-03-22T18:05:39+00:00","dateModified":"2019-02-14T21:04:00+00:00","mainEntityOfPage":{"@id":"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/"},"wordCount":213,"commentCount":13,"publisher":{"@id":"https:\/\/billdwhite.com\/wordpress\/#\/schema\/person\/ea6b87554d0eed13a0152765dd01d314"},"articleSection":["Adobe Flex"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/","url":"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/","name":"Spark Physics with Flex 4 Components and Box2D - Bill White","isPartOf":{"@id":"https:\/\/billdwhite.com\/wordpress\/#website"},"datePublished":"2010-03-22T18:05:39+00:00","dateModified":"2019-02-14T21:04:00+00:00","breadcrumb":{"@id":"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/billdwhite.com\/wordpress\/2010\/03\/22\/spark-physics-with-flex-4-components-and-box2d\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/billdwhite.com\/wordpress\/"},{"@type":"ListItem","position":2,"name":"Spark Physics with Flex 4 Components and Box2D"}]},{"@type":"WebSite","@id":"https:\/\/billdwhite.com\/wordpress\/#website","url":"https:\/\/billdwhite.com\/wordpress\/","name":"Bill White's Blog","description":"UI Development and Data Visualization:  Angular \/ React \/ D3 \/ Typescript \/ Javascript \/ UI \/ UX \/ Etc","publisher":{"@id":"https:\/\/billdwhite.com\/wordpress\/#\/schema\/person\/ea6b87554d0eed13a0152765dd01d314"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/billdwhite.com\/wordpress\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/billdwhite.com\/wordpress\/#\/schema\/person\/ea6b87554d0eed13a0152765dd01d314","name":"Bill White","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/billdwhite.com\/wordpress\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3c3595ee8305a186eea4ea5286143893?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3c3595ee8305a186eea4ea5286143893?s=96&d=mm&r=g","caption":"Bill White"},"logo":{"@id":"https:\/\/billdwhite.com\/wordpress\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/www.billdwhite.com"]}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/billdwhite.com\/wordpress\/wp-json\/wp\/v2\/posts\/256","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/billdwhite.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/billdwhite.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/billdwhite.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/billdwhite.com\/wordpress\/wp-json\/wp\/v2\/comments?post=256"}],"version-history":[{"count":1,"href":"https:\/\/billdwhite.com\/wordpress\/wp-json\/wp\/v2\/posts\/256\/revisions"}],"predecessor-version":[{"id":1389,"href":"https:\/\/billdwhite.com\/wordpress\/wp-json\/wp\/v2\/posts\/256\/revisions\/1389"}],"wp:attachment":[{"href":"https:\/\/billdwhite.com\/wordpress\/wp-json\/wp\/v2\/media?parent=256"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/billdwhite.com\/wordpress\/wp-json\/wp\/v2\/categories?post=256"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/billdwhite.com\/wordpress\/wp-json\/wp\/v2\/tags?post=256"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}